| 5.1.plot.interactives | R Documentation | 
Recovering information from existing lattice plots.
getXY(n = -1, ..., unit = "native", scale.correction = NULL)
getLatLon(...,   
          scale.correction = function(x) {
                                temp <- MercatorXY2LatLon(x$x, x$y)
                                as.list(as.data.frame(temp))
                            })
| n | If positive, the maximum number of points to locate. If negative (default), unlimited. | 
| unit |  The unit to use when reporting located points, by 
default  | 
| scale.correction | The correction to apply if the plot has locally scaled axes. See Note below. | 
| ... | Additional arguments, passed on to related functions. These may be subject to revision, but are currently: 
 | 
getXY is an interactive function which returns 
the locations of points on a plot selected using the 
mouse (left click to select points; right click and 
stop to end point collection; escape to abort without 
returning any values). 
It is a wrapper for the grid function 
grid.locator that behaves more like 
locator, the equivalent function intended 
for use with plot outputs. 
By default getXY selections are not automatically 
marked. Adding common plot parameters to the function 
call overrides this behaviour, e.g. to add red symbols 
and lines.  
ans <- getXY(col = "red", pch = 4, type = "b")
getXY also provides a mechanism to handle data plotted on 
locally scaled axes. See Note below.
getLatLon is wrapper for getXY for use 
with loaMapPlot and other similarly 
georeferenced plots. See Note below.
getXY returns the x and y coordinates of 
the selected points on a plot as a list containing two 
components, x and y.
getLatLon returns the latitude and longitude 
values of the selected points on a map as a list 
containing two components, lat and lon.
getXY recovers the (x, y) coordinates of points selected 
on a previously generated plot.
Some plots, use local scaling. For example, when plotting latitude, longitude data on a map a scale correction may be used to account for the curvature of the Earth. Similarly, if different data series are plotted on primary and secondary axes in a single plot, some or all data may be normalised. In such cases scaling may be local, i.e. what you actually plot may not be exactly what the annotation says it is.
Using getXY on such plots would recover the actual (x, y) 
coordinates of the points selected.      
However, corrections can be applied using scale.correction, 
if it is supplied, to convert these to the same scale as the axes 
annotation. The correction should be a function that can be 
applied directly to a standard getXY output (a list of 
x and y values) and rescale x and y to give 
their 'corrected' values.
getLatLon provides an example of the mechanism, and is 
for use with georeferenced plots that have been locally scaled 
using LatLon2MercatorXY. getLatLon uses 
MercatorXY2LatLon to rescale x and y 
values and then as... functions to convert the outputs of 
this step to a list format like that generated by locator, 
grid.locator or getXY.    
Karl Ropkins
This function makes extensive use of code developed by others.
lattice: Sarkar, Deepayan (2008) Lattice: Multivariate Data Visualization with R. Springer, New York. ISBN 978-0-387-75968-5
RgoogleMaps: Markus Loecher and Sense Networks (2011). RgoogleMaps: Overlays on Google map tiles in R. R package version 1.1.9.6. http://CRAN.R-project.org/package=RgoogleMaps
In other packages: See grid.locator; 
trellis.focus and lpoints in lattice.    
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.