Description Usage Arguments Details Value Author(s) See Also Examples
Part of the playwith Application Programming Interface.
1 2 3 |
playState |
a |
expr |
an expression, typically a drawing operation, to evaluate in the plot space. It will be quoted (see examples). |
space |
the plot space (viewport) to go to before evaluating |
clip.off |
enforce no clipping of drawing operations:
see |
return.code |
if |
This function allows an arbitrary expression to be evaluated while some part of the plot has been made active
(i.e. moving to a grid graphics viewport). Grid viewports are used also to represent spaces in a base graphics
plot (using the gridBase
package. That means expr
can always use Grid drawing operations.
The default space="plot"
will work for base graphics, grid graphics and for single-panel lattice plots.
It will also work for multi-panel lattice plots when one panel is in focus (see trellis.focus
).
Using space="page"
will apply to the whole device space in
normalised device coordinates (0–1).
Other functions such as playSelectData
and playPointInput
return values that can be used directly for the space
argument.
the value returned by expr
.
Felix Andrews felix@nfrac.org
playwith.API,
playSelectData
,
playPointInput
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | if (interactive()) {
library(lattice)
library(grid)
packs <- paste("packet", rep(1:4, each=4))
playwith(xyplot(1:16 ~ 1:16 | packs))
myGp <- gpar(fill="red", col="black", alpha=0.5)
## draw in a specific packet
playDo(playDevCur(), grid.circle(gp=myGp), space="packet 2")
## draw in default space="plot" after focussing on one panel
trellis.focus("panel", 1, 1)
packet.number() # 1, same as space="packet 1"
playDo(playDevCur(), grid.circle(gp=myGp))
trellis.unfocus()
## space="plot" does not work in a multi-panel plot
## unless one panel is in focus
try(playDo(playDevCur(), grid.circle(gp=myGp)))
## draw on the whole page
playDo(playDevCur(), grid.circle(gp=myGp), space="page")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.