
playwith
Application Programming Interface.whichSpace(playState, x.device, y.device)
deviceCoordsToSpace(playState, x.device, y.device, space = "plot")
playState
object representing the plot, window and device.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.playwith.API
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")
}
Run the code above in your browser using DataLab