[R] R Graphics into Latex
Duncan Murdoch
murdoch at stats.uwo.ca
Thu Feb 25 01:00:53 CET 2010
On 24/02/2010 6:29 PM, Lars Bishop wrote:
> Hi,
>
> I'm new in Latex and I'm trying to include an R chart into a Latex document.
>
> This is what I'm doing:
>
> 1) In R: save the chart as a a Postcript in a folder C:/xxx/Density.eps
>
> 2) In Latex (using TexWorks on windows xp) :
>
> In the preambule:
>
> \documentclass[11pt]{article}
> \usepackage{graphicx}
> \begin{document}
>
> blah..blah…blah
>
> \begin{figure}
> \centering
> \includegraphics{C:/xxx/Density.eps}
> \label{fig:Density}
> \end{figure}
>
> --This is the Error Message I'm getting:
>
> LaTeX Warning: File `R:/MarsTH/Studies/Misc/LIA QA/R/Density.eps' not found
LaTeX generally doesn't work well with spaces in filenames. I'd save
the graphic in the same directory as the .tex file (or a simple
subdirectory of it, say "figs") and then use an include like
\includegraphics{Density.eps}
or
\includegraphics{figs/Density.eps}
> on
>
> input line 26.
>
> ! LaTeX Error: Unknown graphics extension: .eps.
As Ray said, this is probably a pdflatex issue. Unfortunately, latex
can handle eps but not pdf, and pdflatex can handle pdf but not eps.
This is why Sweave produces both by default. If you do the same, then
you could use
\includegraphics{Density}
with no extension, and both systems would look for extensions they
recognize.
Duncan Murdoch
>
> See the LaTeX manual or LaTeX Companion for explanation.
>
> Type H <return> for immediate help.
>
> I'll appreciate your help.
> Thanks in advance,
>
> Lars.
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list