R/General Information on Plotting
(animation) |
|||
Line 1: | Line 1: | ||
=Graphics Devices= | =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 tips | LaTeX]]) to produce figures in R directly as a pdf file. To learn more about this option, get help on ?pdf within R. | 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 tips | 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 === | ||
+ | [http://www-user.uni-bremen.de/~skupin/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). | ||
+ | <pre> | ||
+ | \documentclass[12pt]{article} | ||
+ | |||
+ | \usepackage{hyperref} | ||
+ | \usepackage[NoDocJS]{pdfanim} | ||
+ | |||
+ | \PDFAnimLoad[width=6in]{refname}{fileprefix}{#files} | ||
+ | |||
+ | \begin{document} | ||
+ | |||
+ | \PDFAnimation{refname} | ||
+ | |||
+ | \end{document} | ||
+ | </pre> | ||
+ | |||
+ | === ImageMagick === | ||
+ | [http://www.imagemagick.org ImageMagick] | ||
==See also== | ==See also== |
Latest revision as of 00:03, 5 January 2010
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}