"Jan Verbesselt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Dear R-helpers,
Is it possible to create a type of 'movie' in R based on the output of several figures (e.g., jpegs) via the plot() function. I obtained dynamic results with the plotting function and would like to save these as a movie (e.g., avi or other formats)? 1) You can create animated GIFs with the caTools package. 2) ImageMagick (clipped from R-Help) It is quite easy to do with ImageMagick (www.imagemagick.org), which can be installed on most OSes. I tried this simple sequence and it worked beautifully. In R: > for(i in 1:5) { + jpeg(paste("fig", i, ".jpg", sep = "")) + hist(rnorm(100)) + dev.off() + } Then from the command line (I tried it using Linux, though it should be the same on any platform): % convert -delay 50 -loop 50 fig*.jpg animated.gif This created animated.gif, a nice animation of my sequence of files. You can control the timing of the animation by playing with -delay and -loop. 3) TCL/TK Animation (clipped from R-Help) The tcltk package also has ways of doing this kind of stuff: library(tcltk) f <- function(){plot(rnorm(1000)); tkcmd("after", 1000,f)} f() (To stop, set f <- NULL) efg ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html