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

_______________________________________________
R-SIG-GUI mailing list
R-SIG-GUI@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-gui

Reply via email to