R/General Information on Plotting
Contents |
Graphics Devices
R plots can be produced in the graphical user interface and viewed there or saved in various formats. However, it can be useful (especially when using LaTeX) to produce figures in R directly as a pdf file. To learn more about this option, get help on ?pdf within R.
Animation
The basic idea is to write out a sequence of pdf files (i.e. myfile0.pdf, myfile1.pdf, myfile2.pdf, ...) from R, then stitch them together into an animation.
pdfanim
pdfanim is a package for LaTeX, so if you want your animation in a LaTeX document or already use LaTeX, this is a great way to go. Here's a sample file, fill in refname with how you want to refer to the animation, fileprefix with the file prefix (i.e. myfile) including relative path if necessary, and #files with how many files there are (assumed to be numbered starting with 0).
\documentclass[12pt]{article} \usepackage{hyperref} \usepackage[NoDocJS]{pdfanim} \PDFAnimLoad[width=6in]{refname}{fileprefix}{#files} \begin{document} \PDFAnimation{refname} \end{document}