[R] Unspecified [upper] xlim/ylim?

Felix Andrews felix at nfrac.org
Wed Jun 16 05:07:47 CEST 2010


You can use one-sided limits like ylim = c(0, NA), xlim = c(NA, 1) in
ggplot2 and lattice >= 0.18 (approximately; the version with R 2.11.0
will do it).

-Felix


On 16 June 2010 01:49, Ted Harding <Ted.Harding at manchester.ac.uk> wrote:
> Greetings!
> I would like to be able to specify a fixed (say) lower limit
> for plotting, while leaving the upper limit "floating, when
> plotting. The context is that the maximum in the data to be
> plotted is unpredictable, being the consequence of a simulation,
> whereas I know that it cannot be less than (say) 0; and I want
> to fix the lower limit at 0 in any plot, leaving the upper limit
> to be assigned by plot() as a result of the computed values.
>
> I know I can do this by determining the max() of the data, and
> then computing a "Ymax" to put in (say) ylim = c(0,Ymax). However,
> for certain reasons, I would prefer not to have to do this.
> (And it's just a preference ... ).
>
> Whereas one can leave the whole issue of setting both plotting
> limits to plot(), by not specifying ylim (or xlim), or one can
> explcitily specify both the upper and lower limits by (say)
> ylim=c(Ymin,Ymax), there seems to be no way of fixing one and
> leaving the other floating so that plot() would do its own thing.
>
> ylim requires two numbers to be given. Things like ylim=c(0,)
> or ylim=c(0,NA) would generate an error.
>
> Am I chasing a phantom? Or is there a way?
> ThanksTed.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 15-Jun-10                                       Time: 16:49:09
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> R-help at 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.
>



-- 
Felix Andrews / 安福立
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 4670
E: felix.andrews at anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/



More information about the R-help mailing list