> -----Original Message-----
> R 1.5.1 in a linux machine.
>
> I am plotting two curves with curve ():
>
> sin(x)/10 and sin(x)
>
> together, one below the other one ( using par ( mfrow = c ( 2, 1 ))).
> What I have noticed is that both curves have the same height but this
> should not be so since the range of values of the first function is
> shorter than the one of the second function.
>
> In the description of par I could not find any command to fix the
> solution.
>
> Thank you.
Presuming that you are referring to the physical vertical dimension of
the plots and not the ranges of the y-axes (which are clearly different
between the two plots), you can use par("fig") to split and adjust the
size of the plotting region areas of the current plot window. See ?par.
The default result of using par("mfrow") is two equally sized plotting
regions.
You'll likely need to play around with the particular numbers that I
have here to get exactly what you want, but this should give you an
example of how it might look.
# save the current parameters
op <- par(no.readonly = TRUE)
# open a new plot window
plot.new()
# adjust the plot region size
# the LL and UR corners of the default region are (0,0) and (1,1)
# par("fig") is (x1, x2, y1, y2)
# set the first region for the small plot at the top
par(fig = c(0, 1.0, .65, 1.0))
# plot the first function in the small region
curve(sin(x) / 10)
# do not overwrite the current plot
par(new = TRUE)
# reset the region for the larger plot at the bottom
# note that I have the vertical dimensions overlap a bit
par(fig = c(0, 1.0, 0, 0.75))
# now draw the larger plot
curve(sin(x))
# restore the original parameters
par(op)
Hope that helps.
Marc
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._