[R] HOW to Create Movies with R with repeated plot()?
(Ted Harding)
Ted.Harding at nessie.mcc.ac.uk
Wed Jul 27 17:44:36 CEST 2005
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 at 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 at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 27-Jul-05 Time: 14:08:00
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list