[R] Retrieving call sequence leading to a plot / Zooming in maps

From: Francois Rousseu <francoisrousseu_at_hotmail.com>
Date: Thu, 28 Apr 2011 14:22:58 -0400

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. Received on Thu 28 Apr 2011 - 18:29:24 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 Thu 28 Apr 2011 - 20:40:35 GMT.

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

list of date sections of archive