Re: [R] Plot zooming i.e. changing ylim according to xlim

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Wed 27 Jul 2005 - 05:02:38 EST

On 7/26/05, Henrik Andersson <h.andersson@nioo.knaw.nl> wrote:
> Dear R-gurus,
>
> I would like to zoom in a plot, e.g. I select a region on the x-axis and
> then I would like the ranges on the y-axis to change accordingly.
>
> Is it possible to do this with existing functions, or do I have to
> invent some data selection before plotting?
>
> See below a short example, where I select ylim with trial and error,
> which I want to avoid.
>
> Cheers, Henrik Andersson
> --------------------------------------------------------------------
> ## Example -- in reality more numbers, no function
> x <- seq(0,20)
> y <- exp(-x)
>
> plot(y~x,type='l')
>
> ## Zoom in the end, to see what's happenning
>
> plot(y~x,type='l',xlim=c(19,20))

I tend to use constructs like

plot(y~x,type='l', subset = x > 15)

(18 is not very interesting).

Deepayan



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 27 05:06:13 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:01 EST