Displaying 1 result from an estimated 1 matches for "plttousr".
2009 Dec 22
1
RGtk2 - retrieve ggraphics mouse coordinates during drag-and-drop event
...olkit"="RGtk2")
w = gwindow("ggraphics example")
table <- gtable(1:10, container=w)
g = ggraphics(cont=w, expand=T)
size(g) <- c(500,500)
Sys.sleep(1)
plot(rnorm(20), col="red")
## convert from "plt" coordinates to more familiar "usr"
pltToUsr = function(x,y) {
plt = par("plt"); usr = par("usr")
c( (usr[2]-usr[1])/(plt[2]-plt[1])*(x - plt[1]) + usr[1],
(usr[4] - usr[3])/(plt[4] - plt[3])*(y - plt[3]) + usr[3])
}
addHandlerFocus(g, handler = function(h,...) {
print(c("focus g"))
})
addHandlerClicked(...