[R] Latex Question

Henrik Bengtsson hb at maths.lth.se
Fri Dec 7 13:15:22 CET 2001


You have to save your plots/figures in EPS format. EPS is basically 
the same as PS (postscript), but it is a one-page document with a
"BoundingBox". 

Example

In [R]:

  ...
  plot(sin(1:10), pch="+")
  dev.print(device=postscript, "myFigure.eps", onefile=FALSE)
  ...

(don't forget the 'onefile' argument that is used by the device driver
'postscript'!).

In LaTeX:

  ...
  Bla bla see Figure~\ref{figMyFigure}.

  \begin{figure}[hbtp]
    \begin{center}
      \resizebox{!}{80mm}{\includegraphics{myFigure.eps}}
    \end{center}
    \caption{The data used...}
    \label{figMyFigure} % <-- NOTE: After \caption!
  \end{figure}
  ...

This requires that you use "\usepackage{graphics}" at the top your LaTeX
document.


Cheers

Henrik Bengtsson

Dept. of Mathematical Statistics @ Centre for Mathematical Sciences 
Lund Institute of Technology/Lund University, Sweden (+2h UTC)
Office: P316, +46 46 222 9611 (phone), +46 46 222 4623 (fax)
h b @ m a t h s . l t h . s e
http://www.maths.lth.se/matstat/staff/hb/



On Thu, 6 Dec 2001, Brian Scholl wrote:

> Sorry this is more of a Latex than an R question. I'd
> like to be able to insert figures created in R in a
> Latex document.  I'm a bit new to Latex so please
> speak slowly.   I'm using winedt/miktex (great
> programs incidentally).  
> 
> Thanks, 
> 
> Brian 
> 
> __________________________________________________
> Do You Yahoo!?

> http://greetings.yahoo.com
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list