Learn R Programming

animation (version 2.0-5)

BM.circle: Brownian Motion in a circle

Description

Several points moving randomly in a circle.

Usage

BM.circle(n = 20, col = rainbow(n), ...)

Arguments

n
number of points
col
colors of points
...
other parameters passed to points

Value

  • Invisible NULL.

Details

This is a solution to the question raised in R-help: https://stat.ethz.ch/pipermail/r-help/2008-December/183018.html.

References

http://animation.yihui.name/prob:brownian_motion_circle

See Also

brownian.motion, rnorm

Examples

Run this code
oopt = ani.options(interval = 0.1, nmax = ifelse(interactive(), 
    300, 2))
par(mar = rep(0.5, 4))
BM.circle(cex = 2, pch = 19)

saveHTML({
    par(mar = rep(0.5, 4), pch = 19)
    ani.options(interval = 0.05, nmax = ifelse(interactive(), 
        100, 10))
    BM.circle(cex = 2, pch = 19)
}, img.name = "BM.circle", htmlfile = "BM.circle.html", ani.height = 450, 
    ani.width = 450, single.opts = "'controls': ['first', 'previous', 'play', 'next', 'last', 'loop', 'speed'], 'delayMin': 0", 
    title = "Brownian Motion in a Circle", description = "Brownian Motion in a circle.")

ani.options(oopt)

Run the code above in your browser using DataLab