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

From: Petr Pikal <petr.pikal_at_precheza.cz>
Date: Tue 26 Jul 2005 - 20:19:36 EST

Well
 here is the better shot

x <- seq(0,20)
y <- exp(-x)
plot(x,y, type="l")
intervalx<-c(19,20)
intervaly<-y[x%in%intervalx]
plot(x,y, xlim=range(intervalx), ylim=range(intervaly), type="l")  

HTH Petr

On 26 Jul 2005 at 11:13, Henrik Andersson 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.
> Mulholland, Tom wrote:
> > Search the archives for zoom and you will find plenty of answers on
>
> this question.
> >
> > RSiteSearch("zoom")
> >
> > Tom
>
> I looked there already, but I could only find interactive zooming,
> which
> is also nice, but I want a non-interactive function that
> automagically
> changes the y-axis to fit only the data specified in the part of the
> x-axis, or the other way around. I guess that was not very clear from
> my first post.
>
> - Henrik
>
> ______________________________________________
> 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

Petr Pikal
petr.pikal@precheza.cz



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 Tue Jul 26 20:24:08 2005

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