autoplay

0th

Percentile

Set playwith to run automatically.

Set playwith to run automatically with Lattice graphics and/or base graphics.

Keywords
iplot , device
Usage
autoplay(on = NA, lattice.on = on, base.on = on, grid.on = on, ask = FALSE)
Arguments
on
TRUE to set playwith to run automatically to display Lattice and base graphics. FALSE to revert to the default plot device (i.e. getOption("device")).
lattice.on
run automatically to display Lattice graphics.
base.on
run automatically to display base graphics (plot etc).
grid.on
run automatically to display grid graphics (except Lattice).
ask
if TRUE, select the appropriate plot call from a list (the call stack) when automatically starting a base graphics plot.
Details

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.

See Also

playwith

Aliases
  • autoplay
Examples
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)

}
Documentation reproduced from package playwith, version 0.9-54, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.