| whichSpace {playwith} | R Documentation |
Part of the playwith Application Programming Interface.
whichSpace(playState, x.device, y.device) deviceCoordsToSpace(playState, x.device, y.device, space = "plot")
playState |
a playState object representing the plot, window and device. |
x.device |
x coordinate in pixels on the graphics device. |
y.device |
y coordinate in pixels on the graphics device. |
space |
character, the plot space for which to get or set limits.
See the space argument to playDo. |
whichSpace returns the space value referring to the
plot space in which the point (x.device, y.device) lies.
See the space argument to playDo.
If the coordinate is not inside any plot spaces, "page" is returned.
deviceCoordsToSpace converts the given device coordinates to native
coordinates in the specified space. It returns a list with numeric components
x and y, and a logical inside, whether the given point
lies inside the space boundaries.
Felix Andrews felix@nfrac.org
if (interactive()) {
library(lattice)
packs <- paste("packet", rep(1:3, each=4))
playwith(xyplot(1:12 ~ 1:12 | packs))
playState <- playDevCur()
dc <- playPointInput(playState)$dc
whichSpace(playState, dc$x, dc$y)
deviceCoordsToSpace(playState, dc$x, dc$y, space="packet 1")
deviceCoordsToSpace(playState, dc$x, dc$y, space="packet 2")
}