[R] R and LaTeX

Mike Prager mike.prager at noaa.gov
Mon Dec 11 19:03:34 CET 2006


David Kaplan <dkaplan at education.wisc.edu> wrote:

> Hi all,
> 
> I have started using LaTeX for writing papers and I have heard that R 
> works well with LaTeX.  I'm specifically interested in how I can have 
> LaTeX read in R generated graphics - for example graphs formed by 
> matplot, or other such  processes.  Does anyone out there use LaTeX and 
> can point me in the right direction?

> David

David--

The basic paradigm is to save the graph from R in encapsulated
Postscript format.  The procedure can vary slightly by the OS
you are using R under.  Under Windows, I usually generate the
graphics in the windows() device, then use savePlot to save it
to eps.

In Latex, you can put 

\usepackage{graphicx}

in the document preamble and something like

\begin{figure}[!th]
\includegraphics[height=8in]{figurename.eps}\\
\end{figure}

into the text to put the figure in a float.  To put in exactly
where the statement occurs, omit putting it into a figure
environment.

HTH,

--Mike

-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.




More information about the R-help mailing list