anim.plots (version 0.2)

anim.barplot: Create an animated barplot.

Description

Create an animated barplot.

Usage

anim.barplot(...)

# S3 method for default anim.barplot(height, times = NULL, show = TRUE, speed = 1, use.times = TRUE, window = t, window.process = NULL, width = 1, space = NULL, names.arg = NULL, beside = FALSE, density = NULL, angle = NULL, col = NULL, border = NULL, horiz = FALSE, xlim = NULL, ylim = NULL, xlab = NULL, ylab = NULL, main = NULL, sub = NULL, offset = NULL, legend.text = NULL, ...)

Arguments

height

a vector, matrix or array. If a vector it is divided up by times and barplot is called on each chunk. If a matrix, barplot is called on each column. If an array, barplot is called on each matrix of form height[,,i].

times

a vector of times. If NULL and height is a matrix, the last dimension of height will be used

show, speed, use.times, window, window.process
width, space, beside, names.arg, density, angle, col, border, horiz, xlim, ylim, xlab, ylab, main, sub, offset, legend.text, ...

arguments passed to barplot.

Details

Arguments width, names.arg, density, angle, col, border and offset may be either vectors of length length(tbl) or matrices with one column for each unique value of times. Other arguments should be length 1 or vectors.

Examples

Run this code
# NOT RUN {
anim.barplot(1:100, times=rep(1:10, each=10), ylim=c(0,100))
## barplot with a matrix
ChickWeight$wq <- cut(ChickWeight$weight, 5)
tbl <- as.array(xtabs(~ wq + Diet + Time, data=ChickWeight))
ptbl <- prop.table(tbl, 2:3)
anim.barplot(ptbl, xlab="Diet", ylab="N", xlim=c(0,8), legend.text=paste(
     "Quintile", 1:5), col=1:5)
anim.barplot(tbl, xlab="Diet", ylab="N", beside=TRUE, ylim=c(0,20),
   legend.text=paste("Quintile", 1:5), col=1:5)
   
# }

Run the code above in your browser using DataCamp Workspace