[R] grid.locator

Gabor Grothendieck ggrothendieck at gmail.com
Mon Sep 26 00:23:30 CEST 2005


Thanks.  Following the example there worked.

I suggest adding trellis.focus to the See Also in ?grid.locator


On 9/25/05, Paul Murrell <p.murrell at auckland.ac.nz> wrote:
> 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.)




More information about the R-help mailing list