[R] R graphs in LaTeX documents?

Michael_Nielsen/Syd/Synergy.SYNERGY@synergy.com.au Michael_Nielsen/Syd/Synergy.SYNERGY at synergy.com.au
Thu Feb 7 22:56:39 CET 2002


I'll admit to being somewhat of a graphics meathead, but recently needed to
put lots of R graphics into a report that I was typesetting with LaTeX
(well, pdflatex on Linux).  I couldn't coerce pdflatex to use the eps
graphics (it seems to be there has to be a way, but I was in too much of a
hurry to try to find it), so I asked R to generate the graphics directly
into PDF, and then included them into my LaTeX with an \includegraphics.
To me, the result looked pretty good -- much better, in fact, than it did
with either jpg or png output, although the poor result with jpg and png
could well be because of my naive choices for the various settings of
things required along the way.

Anyway, I am continually impressed with R's ability to produce good results
in spite of my somewhat inelegant (ok, ham-fisted) approach.

Regards,

Mike


                                                                                                                           
                    Michael Grant                                                                                          
                    <mwgrant2001 at yahoo.c        To:     Robert Lundqvist <Robert.Lundqvist at ies.luth.se>,                   
                    om>                         "'r-help at lists.R-project.org'" <r-help at stat.math.ethz.ch>                  
                    Sent by:                    cc:                                                                        
                    owner-r-help at stat.ma        Subject:     Re: [R] R graphs in LaTeX documents?                          
                    th.ethz.ch                                                                                             
                                                                                                                           
                                                                                                                           
                    08/02/2002 12:25 AM                                                                                    
                                                                                                                           
                                                                                                                           





--- Robert Lundqvist <Robert.Lundqvist at ies.luth.se>
wrote:
> I have tried to find a neat way to include graphs
> from R in LaTeX documents,
> but have not succeeded (I work with a WinEdt/MikTeX
> combination). The two
> roads ...

Hi Robert,

Perhaps your difficulties lie on the LaTeX side of the
equation. I've used R versions 1.23, 1.31 and now
1.41; gone thru 'mass production' of numerous
postscript graphics using both the menu and coding;
and pulled those graphics into LaTeX (and
Word)directly without a hitch--EXCEPT IN THE
BEGINNING. And those problems were
first-time-using-LaTeX-related.

Assuming I had saved the R graphic as 'ipu238.eps' the
following (edited) has worked for me:


\documentclass[10pt,letterpaper]{report}
...
\usepackage{graphicx}
...

\begin{document}

...as can be seen in Figure \ref{fig:ipu238}. The
confidence bands are wide and ...

\begin{figure}
           \begin{center}
                     \includegraphics[scale=0.9]{ipu238}
           \end{center}
  \caption{Intervals for plutonium 238 versus europium
154 using all samples.}
           \label{fig:ipu238}
\end{figure}

...

\end{document}


FYI, I use TeXnicCenter/MikTeX for the LaTeX. They
work very well together.(Note: LyX on windows is
cygwin based and requires an Xserver, e.g. XFree86.
Might as run Linux to begin with! Hmmm, not a bad
idea, but RWin is getting pretty sweet.)

Regards,
Mike

__________________________________________________



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
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