[R-gui] ggraphics and retrieving mouse coordinate as npc coordinates
Mark Heckmann
mark.heckmann at gmx.de
Wed Dec 23 04:07:25 CET 2009
Hi all,
i tried to retrieve the mouse coordinates from a ggraphics widget
using a handler. With base graphics system it works fine, but using
grid, the returned values do not make sense to me. How can I transform
the returned values to e.g. npc coordinates?
library(RGtk2)
library(gWidgets)
w = gwindow("ggraphics example")
g = ggraphics(cont=w, expand=T)
size(g) <- c(900,900)
Sys.sleep(1)
print(grid.rect())
addHandlerClicked(g, handler = function(h,...) {
x <- h$x; y <- h$y
print(c("pressed at:", c(x,y)))
})
Thanks and merry X-mas
Mark
–––––––––––––––––––––––––––––––––––––––
Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Vorstraße 93 B01
28359 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com
More information about the R-SIG-GUI
mailing list