On Wed, 2006-06-21 at 11:55 -0500, Marc Schwartz (via MN) wrote: > On Wed, 2006-06-21 at 12:22 -0400, Baoqiang Cao wrote: > > Dear All, > > > > I tried to plot a variety of lines(curves) on same figure. What I did > > is, > > plot(x=x1,y=y1) > > lines(x=x2,y=y2) > > lines(x=x3,y=y3) > > ... > > > > In my data, the maximum of y1 is much smaller than those maximums of > > other y vectors. So, in the figure I got, there are some curves which > > are not complete, I mean, they were cut off at the maximum of y1 at > > the y axis. Could anybody point out some right commands I need use? > > Thanks! > > > > Best, > > Cao > > You will want to use the 'xlim' and 'ylim' arguments in plot() to set > the initial axis ranges for the scatter plot based upon the ranges of > the combined x* or y* vectors. That way, the plot region ranges are set > to include all of your values. > > x.range <- range(x1, x2, x3) > y.range <- range(y1, y2, y3) > > plot(x1, y1, xlim = x.range, ylim = y.range) > lines(x2, y2) > lines(x3, y3) > > See ?plot.default for more information.
One other note, which is to review: ?matplot which also has help for matpoints() and matlines(), which will do the common axis range adjustments for you. This will be helpful if you are going to be plotting a larger number of points/lines in a single graphic. HTH, Marc ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html