[R] Automatic adjustment of axis ranges

Daniel Mastropietro mastropi at uwalumni.com
Fri Jul 19 06:26:54 CEST 2002


>|> Hello,
>|>
>|> I would like to know if it is possible to add new points to a given plot
>|> 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:
>|>
>|> plot(1:10,1:10);
>|> 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.
>
>I think you'd need to build some logic into a function that recognised
>that the points were outside what plot had been set to, and then redo
>the plot with those limits.  Could be done, but it's much easier to
>build the limits in in the first place with xlim and/or ylim.

The problem with defining xlim and ylim in advance is that you need to know 
all the graphs that you want to do in the same plot before starting to do 
the first graph. And this may not be the case if one is in the stage of 
trying different things. So, one needs to redo all the graphs that had been 
done in order to add a new one to the current plot.

>Asking what you want is kind of like having your car automatically
>back up to the last service station after you've run out of petrol.
>They're not built like that.

Actually some pieces of software, such as Matlab, do the automatic 
adjustment, and I find it a very useful feature. It would be great if this 
feature could be added to R.

Regards,
Daniel Mastropietro


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