Re: [Rd] "open-ended" plot limits?

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Thu, 05 Feb 2009 14:40:28 -0700

Or use range( 0, y1, y2, y3, na.rm=TRUE, finite=TRUE )

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_imail.org
801.408.8111



> -----Original Message-----
> From: William Dunlap [mailto:wdunlap_at_tibco.com]
> Sent: Thursday, February 05, 2009 2:38 PM
> To: Greg Snow; marc_schwartz_at_comcast.net; ted.harding_at_manchester.ac.uk
> Cc: R-Devel
> Subject: RE: [Rd] "open-ended" plot limits?
>
>
> > -----Original Message-----
> > From: r-devel-bounces_at_r-project.org
> > [mailto:r-devel-bounces_at_r-project.org] On Behalf Of Greg Snow
> > Sent: Thursday, February 05, 2009 1:15 PM
> > To: marc_schwartz_at_comcast.net; ted.harding_at_manchester.ac.uk
> > Cc: R-Devel
> > Subject: Re: [Rd] "open-ended" plot limits?
> >
> > I use range( 0, y ) rather than c(0, max(y)), that way if
> > there are any y values less than 0, the limits still include
> > them (and it is slightly shorter :-).
>
> To mimic what plot does by default you must ignore the NA's
> and Inf's in y with something like
> range(0,y[is.finite(y)])
> It might be nice to have an na.rm-like argument for ignoring
> the Inf's - it gets tedious to write
> range(0, y1[!is.finite(y1)], y2[!is.finite(y2)], ...)
> Also, when you get into really long vectors the explicit subscripting
> can run you out of memory.
>
> Bill Dunlap
> TIBCO Software Inc - Spotfire Division
> wdunlap tibco.com
>
> >
> > This also extends to cases where you may know that you will
> > be adding additional data using points or lines, so you can
> > do ylim=range(0, y1, y2, y3) and it will give enough room to
> > add the other y variables in latter.
> >
> > Hope this helps,
> >
> > --
> > Gregory (Greg) L. Snow Ph.D.
> > Statistical Data Center
> > Intermountain Healthcare
> > greg.snow_at_imail.org
> > 801.408.8111
> >
> >
> > > -----Original Message-----
> > > From: r-devel-bounces_at_r-project.org [mailto:r-devel-bounces_at_r-
> > > project.org] On Behalf Of Marc Schwartz
> > > Sent: Thursday, February 05, 2009 1:57 PM
> > > To: ted.harding_at_manchester.ac.uk
> > > Cc: R-Devel
> > > Subject: Re: [Rd] "open-ended" plot limits?
> > >
> > > on 02/05/2009 02:48 PM (Ted Harding) wrote:
> > > > Hi Folks,
> > > > Maybe I've missed it already being available somehow,
> > > > but if the following isn't available I'd like to suggest it.
> > > >
> > > > If you're happy to let plot() choose its own limits,
> > > > then of course plot(x,y) will do it.
> > > >
> > > > If you know what limits you want, then
> > > > plot(x,y,xlim=c(x0,x1),ylim(y0,y1)
> > > > will do it.
> > > >
> > > > But sometimes one would like to
> > > > a) make sure that (e.g.) the y-axis has a lower limit (say) 0
> > > > b) let plot() choose the upper limit.
> > > >
> > > > In that case, something like
> > > >
> > > > plot(x,y,ylim=c(0,NA))
> > > >
> > > > would be a natural way of specifying it. But of course that
> > > > does not work.
> > > >
> > > > I would like to suggest that this possibility should be
> available.
> > > > What do people think?
> > > >
> > > > Best wishes,
> > > > Ted.
> > >
> > > Ted,
> > >
> > > Unless I am mistaken in what you are looking for:
> > >
> > > plot(x, y, ylim = c(0, max(y)))
> > >
> > > would seem do what you want. If otherwise unspecified, plot() uses
> > > range(y) to define 'ylim'.
> > >
> > > HTH,
> > >
> > > Marc Schwartz
> > >
> > > ______________________________________________
> > > R-devel_at_r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> > ______________________________________________
> > R-devel_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
______________________________________________ R-devel_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 05 Feb 2009 - 21:41:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 06 Feb 2009 - 11:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive