Learn R Programming

anim.plots (version 0.2.2)

anim.contour: Create an animated contour plot or perspective plot

Description

Create an animated contour plot or perspective plot of 3D data.

Usage

anim.contour(...)

anim.filled.contour(...)

# S3 method for default anim.filled.contour(...)

anim.persp(...)

# S3 method for default anim.contour( x, y, z, times, speed = 1, use.times = TRUE, window = t, window.process = NULL, show = TRUE, fn = contour, ... )

Arguments

x, y, z, ...

arguments passed to contour or persp

times, speed, use.times, window, window.process, show

see anim.plot for details.

fn

underlying function to use.

Examples

Run this code

tmp <- volcano
tmp[] <- 200 - ((row(tmp) - 43)^2 + (col(tmp) - 30)^2)/20
cplot <- array(NA, dim=c(87,61,20))
cplot[,,1] <- tmp
cplot[,,20] <- volcano
cplot <- apply(cplot, 1:2, function(x) seq(x[1], x[20], length.out=20))
cplot <- aperm(cplot, c(2,3,1))
anim.contour(z=cplot, times=1:20, speed=3, levels=80 + 1:12*10, lty=c(1,2,2))
anim.filled.contour(z=cplot, times=1:20, speed=3, levels=80 + 1:12*10, 
   color.palette=terrain.colors)
   
cplot2 <- apply(cplot, 1:2, function(x) seq(0, x[20], length.out=20))
cplot2 <- aperm(cplot2, c(2,3,1))
anim.persp(z=cplot2, times=1:20, xlab="", ylab="", zlab="Height", phi=45,
theta=30, speed=5, border=NA, r=3, col="yellowgreen", shade=.5, box=FALSE)
 

Run the code above in your browser using DataLab