
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]]

