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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 8 Feb 2002 Michael_Nielsen/Syd/Synergy.SYNERGY at synergy.com.au wrote:
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
The only good way is to convert .eps to pdf (or, much worse, to png).
The best way to do that is Adobe Distiller, the second-best way epsftopdf,
a Perl script / Windows program calling ghostscript, preferably 6.0 or
later. It is practically identical to what bitmap() does in R.
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.
That's typical for the sort of graphs one produces in R.
Anyway, I am continually impressed with R's ability to produce good results
in spite of my somewhat inelegant (ok, ham-fisted) approach.
I wrote the pdf() driver because it seemed a cleaner solution, and it was
an intellectual challenge. From this thread it seems it has much more use
than I realized, which is nice to know.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 8 Feb 2002 Michael_Nielsen/Syd/Synergy.SYNERGY at synergy.com.au wrote:
<<<SNIP>>>
That's typical for the sort of graphs one produces in R.
Anyway, I am continually impressed with R's ability to produce good results
in spite of my somewhat inelegant (ok, ham-fisted) approach.
I wrote the pdf() driver because it seemed a cleaner solution, and it was
an intellectual challenge. From this thread it seems it has much more use
than I realized, which is nice to know.
I, for one, am extremely grateful for pdf(). Most of the graphics I
produce with R end up in pdf and the pdf() driver has performed
flawlessly. Thank you.
---JRG
John R. Gleason
Syracuse University
430 Huntington Hall Voice: 315-443-3107
Syracuse, NY 13244-2340 USA FAX: 315-443-4085
PGP public key at keyservers
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I wrote the pdf() driver because it seemed a cleaner solution, and it was
an intellectual challenge. From this thread it seems it has much more use
than I realized, which is nice to know.
pdf() has been a *huge* benefit to me, both on its own, and for pdflatex
graphics inclusion. Thanks. An awful lot.
Cheers
Jason
Indigo Industrial Controls Ltd.
64-21-343-545
jasont at indigoindustrial.co.nz
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._