Re: [R] HOW to Create Movies with R with repeated plot()?

From: Ted Harding <Ted.Harding_at_nessie.mcc.ac.uk>
Date: Thu 28 Jul 2005 - 01:44:36 EST


On 27-Jul-05 Jan Verbesselt wrote:
> 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)?

A similar question was discussed on R-help some months ago: Start at

  Cari G Kaufman <cgk@stat.cmu.edu>,
  "[R] animation without intermediate files?"   Thu, 6 Jan 2005 16:21:36 -0500 (EST)

However, this is not quite your question! It seems you would be content with making a movie out of files already saved from R, so it's not a "real-time" situation.

There are several approaches you could adopt.

One (if you are using Linux with ImageMagick installed -- or if this is available for your platform if different) is to use the program 'animate' in that suite of programs.

The format of the image files does not matter for 'animate' (though I think all should have the same format), so they could be .jpg, .gif, etc. Suppose you had a set of files

  graph001.jpg
  graph001.jpg
  ...
  graph100.jpg

then the command

  animate graph*.jpg

would present them as an animation in due order. There are several options to the 'animate' command which you can use to control features of how they are displayed. One you would probably want to use is "-delay" -- e.g.

  animate -delay 7 graph*.jpg

would pause for 7/100 seconds between successive images.

Another option is to create an "animated GIF" -- a single file which encapsulates several images and displays them in sequence when the file is opened with suitable software (most Web browsers do this well; likewise so does ImageMagick's 'display').

Programs which can create animated GIFs include the GIMP and gifsicle in the Free Software world. There are also several programs for non-Linux platforms.

Sorry I can't help with suggestions for creating .avi files.

Best wishes,
Ted.



E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861
Date: 27-Jul-05                                       Time: 14:08:00
------------------------------ XFMail ------------------------------

______________________________________________
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 Received on Thu Jul 28 01:54:36 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:05 EST