Jan 012011

Last year I posted an animation created in R to celebrate the new year, and this year I’ve got a more fabulous animation. Unfortunately our Lord of CRAN (Kurt) has been out of office for several days, so I’m unable to publish my animation package on CRAN as scheduled. Anyway, for those who are curious about the new version the animation package, you can download the version 2.0-0 from my GitHub development page.

Set Fireworks in R 2011

Set Fireworks in R 2011

The above animation comes from the demo('fireworks') in the R package animation 2.0-0. Thanks for the contribution of Weicheng Zhu.

Another demo I did not mention on this Christmas was demo('Xmas2'):

Xmas snowflakes in R

Xmas snowflakes in R

Thanks for the contribution of Jing Jiao.

There are a whole bunch of new features in the animation package v2.0-0 (this version is a milestone), but I will keep silent for the time being, since it is not published on CRAN yet.

Dec 242009

Life should be fun. I saw a post in R-help list saying Merry Christmas to other useRs, and I followed up by some R code which can produce a naive animation like this:

Here is the code to generate the above Flash animation with shining Christmas:

library(animation)
saveSWF({
    n = length(speed <- runif(angle <- runif(x <- strsplit("MERRY CHRISTMAS",
        "")[[1]], 0, 360), 0, 15))
    for (j in 1:300) {
        angle = angle + speed
        plot.new()
        plot.window(c(1, n), c(0, 1))
        for (i in 1:n) text(i, 0.5, x[i], srt = angle[i], cex = runif(1,
            1, 4), col = sample(colors(), 1))
        text(n, 0, "Yihui @ 2009-12-24 (http://yihui.name)",
            adj = c(1, 0), col = "white", cex = 0.8)
    }
}, interval = 0.04, dev = "pdf", outdir = getwd(), para = list(mar = rep(0,
    4), bg = "black"), width = 8, height = 1)
## in animation package (>=1.1-0), see demo('Xmas')

There are other animation formats in the R package animation:

  1. use saveMovie() to get a GIF animation (need ImageMagick)
  2. ani.start() and ani.stop() can produce an HTML page with the animation in it
  3. saveLatex() can embed an animation into a PDF document
Dec 262007

On the Christmas Eve, there was a man dressed as “Santa Claus” in the street, with a bag in his hands as usual… So everybody just gazed at that big bag, thinking about how many presents were there…

Guess what?

This “Santa” opened his bag and asked the passers-by, “Ladies and gentlemen, would you please give me some money?”

WWW.YIHUI.NAME XIE@YIHUI.NAME © 2007 - 2012 by Yihui Xie