On 08/31/2010 08:26 PM, Wonsang You wrote:
Hi, R-Helpers,
I would like to ask about multiple graphs in one figure. I tried to execute
the following codes.
xlim<- c(1,100)
ylim<- c(1,4)
plot(NA, xlim=xlim, ylim=ylim)
x<- c(1:100)
for(j in seq(1,10,by=1)) {
y<- j*x^2+log(j)
lines(x, y)
}
In the above codes, I had to arbitrarily set up the coordinate range of the
figure in advance before calculating the values y. (seexlim and ylim)
In results, the figure did not contain all data since most of data were
outside the predefined range.
I am wondering about how to control xlim and ylim adaptive to the real range
of data, in order to include all data in the figure.
Hi Stephen,
One easy way is:
xlim<-range(x)
ylim<-range(y)
Jim
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.