[R] playing with R: make a animated GIF file...

Katharine Mullen kate at few.vu.nl
Thu Oct 6 12:57:17 CEST 2005


you could first make the frames to put together in R, then outside of R
glue the frames into a gif.

eg:

frames<-10
for(i in 1:frames) {
      jpeg(paste("ani_", i, ".jpg", sep = ""))
      plot(1:10,1:10, col = i)
      dev.off()
}

then use an image editing program to glue the jpgs together -- eg free and
crossplatform imagemagick (www.imagemagick.org).
under linux and once imagemagick is installed, the command

$ convert -delay 10 ani_*.jpg animation.gif

makes a looping animated gif `animation.gif' with 10/100 sec. between
frame flips.

----
Katharine Mullen
Department of Physics and Astronomy
Faculty of Sciences
Vrije Universiteit
de Boelelaan 1081
1081 HV Amsterdam
The Netherlands
room: T.1.06
tel: +31 205987870
fax: +31 205987992
e-mail: kate at nat.vu.nl
http://www.nat.vu.nl/~kate/




More information about the R-help mailing list