Re: [R] help on ploting various lines

From: Marc Schwartz (via MN) <mschwartz_at_mn.rr.com>
Date: Thu 22 Jun 2006 - 02:55:18 EST

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.

HTH, Marc Schwartz



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 Received on Thu Jun 22 02:59:57 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 22 Jun 2006 - 04:12:11 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.