Saving dynamic visualization as HTML file

In the previous section, it was shown that we could use the R package called animation to generate dynamic pictures, such as a YouTube video. Actually, we could generate HTML for our students or audience to watch, shown here:

library(animation) a<- c(3, 3, 1, 0.5) b<- c(2, 0.5, 0) part1<-"Random walk on the 2D plane: for each point" part2<-"(x, y), x = x + rnorm(1) and y = y + rnorm(1)." des<-c(part1,part2) titleName<-"Demonstration of Brownian Motion" # saveHTML({ par(mar =a, mgp =b, tcl = -0.3,cex.axis = 0.8, cex.lab = 0.8, cex.main = 1) ani.options(interval = 0.05, nmax = ifelse(interactive(),150, 10)) brownian.motion(pch = 21, cex = 5, col = "red", bg = "yellow") },description =des,title = titleName) ...

Get Hands-On Data Science with Anaconda now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.