From: Greg Snow <Greg.Snow_at_imail.org>

Date: Thu, 28 Apr 2011 14:24:43 -0600

Date: Thu, 28 Apr 2011 14:24:43 -0600

You could always put the commands into a script or function, then instead of retyping everything just run the script or function.

There is the zoomplot function in the TeachingDemos package which does what you are suggesting (but my quick test did not work with your map). You could use that as a starting point to write your own function (or find why it is not working for the map). It might work better on a smaller resolution.

There is also the history function (and friends) that will show recent commands, but figuring out which functions contributed to the plot and how to modify and rerun them could be tricky.

You might try writing a single function that takes the limits of the plot then runs the plot commands and creates your plot, then either run this function with different limits, or run it inside of tkexamp (also in the TeachingDemos package) so that you can modify the limits using controls and see the zoomed plot that way. The fgui, playwith, and rpanel packages may also give some other options for interactively zooming the plot.

You could also send your plot to a file, then do you zooming in an outside program (inkskape will edit svg files).

-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow_at_imail.org 801.408.8111Received on Thu 28 Apr 2011 - 20:25:06 GMT

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

______________________________________________ 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.

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:50:34 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.
*