Showing posts with label animation in R. Show all posts
Showing posts with label animation in R. Show all posts

Wednesday, May 12, 2010

The Bubbles Animation in Hans Rosling's Talk

##The Bubbles Animation in Hans Rosling's Talk


library(animation)
ani.options(interval = 0.2, ani.height = 450, ani.width = 600, outdir = getwd(),
title = "The Bubbles Animation in Hans Rosling's Talk",
description = "An imitation of Hans Rosling's moving bubbles.")
ani.start()
par(mar = c(4, 4, 0.2, 0.2))
# with 'years' as the background
Rosling.bubbles(text = 1951:2000)
ani.stop()


#The code was obtained from this website:
# http://animation.yihui.name/da:ts:hans_rosling_s_talk
#more animations at : http://animation.yihui.name/animation:start


for (i in 1:360) {
plot(1, ann = F, type = "n", axes = F)
text(1, 1, "Animation", srt = i, col = rainbow(360)[i], cex = 7 *
i/360)
Sys.sleep(0.01)
}