Description Usage Arguments Details Author(s) See Also Examples
Set playwith
to run automatically with Lattice graphics and/or base graphics.
1 |
on |
|
lattice.on |
run automatically to display Lattice graphics. |
base.on |
run automatically to display base graphics ( |
grid.on |
run automatically to display grid graphics (except Lattice). |
ask |
if |
When lattice.on
is TRUE
, the print.trellis
function,
which is typically called implicitly to create lattice plots, will trigger
playwith
, passing the original high-level call.
So for lattice plots only, this is like changing your default plot device.
It only replaces the screen device: plotting to a file device will work as normal.
This feature requires lattice
package version 0.17-1
or later.
When base.on
is TRUE
, any new base graphics plot will trigger
playwith
(via a hook in plot.new
), and the high-level
plot call is taken to be the first call (to a named function) on the call stack.
The usual base graphics paradigm of building up a plot incrementally will not work well,
because only the initial plot call is recorded, so any further additions will be lost when the plot is redrawn.
For similar reasons, multiple-figure plots may not be redrawn correctly.
The high-level plot will be called twice initially, due to constraints of the mechanism.
The grid.on
argument is analogous to base.on
for grid graphics,
using a hook in grid.newpage
.
Note that this automatic behaviour is not a full replacement for calling
playwith
directly, since it does not allow to you specify any of the
optional arguments.
Another possibility is options(device="playwith")
.
This will act as a default device but without most of the
interactive features. The plot can still be annotated with text and
arrows in this case.
Felix Andrews felix@nfrac.org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | if (interactive()) {
## lattice graphics in the playwith interface:
autoplay(lattice=T)
xyplot(Sepal.Length ~ Sepal.Width | Species, data=iris)
dev.off()
## lattice graphics in your usual screen device:
autoplay(lattice=F)
xyplot(Sepal.Length ~ Sepal.Width | Species, data=iris)
## base graphics in the playwith interface:
autoplay(TRUE)
frog <- rnorm(64)
hist(frog)
dev.off()
## base graphics in your usual screen device:
autoplay(FALSE)
hist(frog)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.