anim.plots (version 0.2)

replay: Replay an anim.frames object

Description

Replay all or some of the frames of an object.

Usage

replay(...)

# S3 method for anim.frames replay(x, frames = 1:length(x), speed = attr(x, "speed"), after = NULL, before = NULL, ...)

# S3 method for anim.frames plot(x, ...)

Arguments

...

other arguments (not currently used)

x

an anim.frames object

frames

numeric vector specifying which frames to replay

speed

a new speed

after

an expression to evaluate after each frame is plotted

before

an expression to evaluate before each frame is plotted

Details

before and after will have the arguments from the frame's call available in their environment - see the example.

The plot method simply calls replay.

Examples

Run this code
# NOT RUN {
myplot <- anim.plot(1:10, 1:10, speed=3)
replay(myplot, speed=5)
replay(myplot, frames=c(1,5,6,10))

myplot <- anim.plot(x<-rnorm(100), x+rnorm(100,0,3), 20, window=1:t, 
     show=FALSE, main="Regressions as sample size increases")
replay(myplot, after=abline(lm(y~x), col="red"))
 
# }

Run the code above in your browser using DataCamp Workspace