[R] How to Adaptively Set Up the Coordinate Range of Multiple Graphs in One Figure

2010-08-31 Thread Wonsang You
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

Re: [R] How to Adaptively Set Up the Coordinate Range of Multiple Graphs in One Figure

2010-08-31 Thread Philipp Pagel
On Tue, Aug 31, 2010 at 03:26:12AM -0700, Wonsang You wrote: 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

Re: [R] How to Adaptively Set Up the Coordinate Range of Multiple Graphs in One Figure

2010-08-31 Thread Jim Lemon
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)

Re: [R] How to Adaptively Set Up the Coordinate Range of Multiple Graphs in One Figure

2010-08-31 Thread baptiste auguie
Hi, It's easy with ggplot2, library(ggplot2) ## create an empty plot p - ggplot(map=aes(x,y)) ## create a dummy list of data.frames with different ranges d - replicate(4, data.frame(x=sample(1:10,1)+rnorm(10), y=sample(1:10,1)+rnorm(10)),

Re: [R] How to Adaptively Set Up the Coordinate Range of Multiple Graphs in One Figure

2010-08-31 Thread Greg Snow
The best approach is to calculate the limits before doing any plotting and set them appropriately. You could use your loop to compute y, but instead of calling lines, store the values, then use a function like matplot (or ggplot2 or lattice) to do the plotting. If you really need to change