Hi,

I'm dealing with a lattice plot inserted into a tk widget and would like to know when a user has clicked on the plot area of a plot (i.e. inside the axes). For example,

library(tkrplot)
library(lattice)
tt <- tktoplevel()
makePlot <- function() print(xyplot(1 ~ 1))
printCoords <- function(x, y) print(c(x, y))
img <- tkrplot(tt, makePlot)
tkbind(img, "<1>", printCoords)
tkpack(img)

I would like to know when a user clicks inside the axes, but don't know how to determine where the plot region is. Essentially, this comes down to answering the following question: Assuming the entire plot is on a unit square, what are the coordinates of the plotting area?

This question is may seem unrelated to tkrplot, but outside of this context I may not get answers that work. I have been playing with both lattice::trellis.focus and grid::grid.locator to no avail.

Thanks,

--sundar

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to