[R] grid.locator

Paul Murrell p.murrell at auckland.ac.nz
Sun Sep 25 22:21:26 CEST 2005


Hi


Gabor Grothendieck wrote:
> If I do:
> 
> library(lattice)
> x <- 1:10
> xyplot(x ~ x)


After the lattice plot, you are back at the top-level grid viewport.


> grid.locator()
> 
> and click on 2,2 say the I get this:
> 
> 
>>grid.locator()
> 
> $x
> [1] 201native
> 
> $y
> [1] 476native


grid.locator() by default gives you the click in "native" coordinates. 
The "native" coordinates for the top-level viewport depend on the 
device;  on-screen it is pixel-based.


> How do I get the user coordinates of the graph?


Look up the lattice function trellis.focus().

Paul


> (If I did not use lattice/grid I could have just done:
> 
> plot(x ~ x)
> locator()
> 
> and it would have worked as expected.)
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/




More information about the R-help mailing list