[R] Automatic adjustment of axis ranges
mschwartz at medanalytics.com
Thu Jul 18 05:03:46 CEST 2002
> -----Original Message-----
> From: owner-r-help at stat.math.ethz.ch
[mailto:owner-r-help at stat.math.ethz.ch] On
> Behalf Of Daniel Mastropietro
> Sent: Wednesday, July 17, 2002 7:13 PM
> To: R-help at stat.math.ethz.ch
> Subject: [R] Automatic adjustment of axis ranges
> I would like to know if it is possible to add new points to a given
> and that the axis ranges be automatically adjusted so that all the new
> points are seen in the plot.
> For example, I am thinking of something like this:
> points(5:20,2*(5:20)); # This would change the x range to 0-20
and the y
> range to 0-40 so that all the new points are fitted in the graph.
> Daniel Mastropietro
To the best of my knowledge, once a plot is drawn in the graphics
device, the plot region axis ranges are fixed.
You can certainly add new points, lines, etc. to an existing plot as you
are doing above, but within the existing axis ranges.
If you need to change the axis ranges themselves, I believe that you
actually have to re-draw the plot.
If you know what the minimum and maximum values of the existing and the
new data points are going to be, you can explicitly define the ranges
with the xlim and ylim arguments to the plot() function. You can either
provide specific numbers or use the range() function to secure the min
and max values from the numeric vectors that you are using as source
If someone has other ideas, I would certainly be interested in how this
could be done.
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