Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Francois Rousseu
> Sent: Thursday, April 28, 2011 12:23 PM
> To: r-help at r-project.org
> Subject: [R] Retrieving call sequence leading to a plot / Zooming in
> maps
>
>
> Hello R users
>
> When I want to zoom in on a map or any plot in R, I usually use the
> locator function to reset the
> limit of the plot and do something like:
>
> library(maptools)
> library(mapdata)
>
> map('worldHires',ylim=c(40,55),xlim=c(-90,-60))
> points(-71,47,col="red",pch=16)
> text(-73,49,"Hello")
>
> l<-locator(2)
>
> map('worldHires',ylim=range(l$y),xlim=range(l$x))
> points(-71,47,col="red",pch=16)
> text(-73,49,"Hello")
>
> I find this a bit annoying to type when there are a lot of things in a
> complex map. Now, what
> I would like to do is create a function that would zoom in on any type
> of plot or map without having
> to retype the steps that lead to the new rescaled plot. For this, I
> guess the function would have to
> find which calls/expressions led to the actual plot. Then, the function
> would only need to change
> the ylim and xlim in the expression leading to the plot creation and
> reevaluate all expressions.
> So my question is this: is there a function that can retrieve the call
> sequence that led to the actual plot?
>
> Perhaps a function similar to this already exists? I've looked into the
> zoom and zoomInPlot functions,
> but none of them do exactly what I want. The zoomInPlot function comes
> close, but it seems to be
> limited to simple plots.
>
> Thanks
> Francois Rousseu
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.