Animated R Plots

Rachel Lynne Wilkerson

WRUG February 2, 2017

Why bother?

What do I need?

  1. the animate package by Yihui Xie and friends
install.packages("animation")
  1. External tools: Imagemagick, GraphicsMagick, LyX, PDFLaTeX, SWF, FFmpeg
brew install imagemagick

What final format will my animation be in?

In general, unless you plan to transport your final animation, use HTML

A simple example

Consider a static plot

A simple example

Write a for loop

library(animation)
saveHTML({
    for (i in 1:10) plot(runif(10), ylim = 0:1)
})

More examples

Possible issues

References

Animate Package References

References

Tutorials

Thank you