[R] can I add to a plot and auto-re-scale axes?

Robert D. Merithew merithew at ccmr.cornell.edu
Mon Oct 1 04:06:47 CEST 2001


(I'm new to R)
 
Is there a way to add data to an existing plot, and have the plot axes
rescaled automatically (i.e. if the new data lie outside the current
axes) ?
 
If not, how can I specify multiple datasets at once, so the axes are
scaled to accomodate all sets?


Details:

(Am I using R's data structures in a reasonable way?)
 
I have many small datasets taken under different conditions, and have
placed the vectors of x-values into one list, and y-values into
another.  The lists are part of a data frame:
 
expts$x[[1]] is a vector of x-coordinates for experiment 1,
expts$y[[3]] is a vector of y-coordinates for experiment 3, etc.
 
I want to plot experiments 1, 4, and 7 together on a single plot, and
have the axes automatically scaled.
 
> plot(expts$x[[1]], expts$y[[1]])
> points(expts$x[[4]], expts$y[[4]])
> points(expts$x[[7]], expts$y[[7]])
 
This works, but won't rescale if experiment 4 has a wider range than
experiment 1.
 
I'm also open to better ways of structuring the data, if that helps.
 
Right now, expts$temp (for example), is a column of the data frame
containing the temperature at which each dataset is taken.  I'd love to
be able to ask for a plot of all datasets with (expts$temp == 25), for
example.  Or build a vector of experiment numbers and plot them all...

thanks,
--
Robert Merithew
Laboratory of Atomic and Solid State Physics
Cornell University, Ithaca, NY


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list