[R] Getting graphs into LaTeX

Andrew Criswell arc at arcriswell.com
Fri Dec 20 07:26:03 CET 2002


Hello ALL:

I ran with success the following commands in R getting a file saved
------------------------------------------------------------------------------------
postscript()

postscript('~/data/st202/2003/lecture00/lecture00-graph-01.eps',
           horizontal = FALSE, height = 6, pointsize = 10)

hist(trial.outcome.5, breaks = 5,
     main = '1000 Replications of 5 Trials of a Coin Toss',
     xlab = 'Frequency of a Tail')
------------------------------------------------------------------------------------
But when I try to include it within a LaTeX document, I get the 
following complaint.

LaTeX document (trix.tex):
------------------------------------------------------------------------------------
\documentclass[11pt]{article}
\usepackage[pdftex]{graphicx,color}
\begin{document}
\includegraphics{lecture00-graph-01.eps}
\end{document}
------------------------------------------------------------------------------------
Which I try to compile with the command:  pdflatex trix.tex

But then, I get this error:
------------------------------------------------------------------------------------
! LaTeX Error: Unknown graphics extension: .eps.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.5 \includegraphics{lecture00-graph-01.eps}

?
------------------------------------------------------------------------------------
Any suggestions?

Thanks,
ANDREW




More information about the R-help mailing list