[R] Getting graphs into LaTeX

Ko-Kang Kevin Wang Ko-Kang at xtra.co.nz
Fri Dec 20 07:42:03 CET 2002


Hi,

----- Original Message -----
From: "Andrew Criswell" <arc at arcriswell.com>
To: "r-help" <r-help at stat.math.ethz.ch>
Sent: Friday, August 22, 2003 2:17 AM
Subject: [R] Getting graphs into LaTeX


> 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')
> --------------------------------------------------------------------------
----------


Have you closed the postscript device?  Normally you need a dev.off() after
you finished the plot.  Try putting dev.off() after your hist().

The other thing is can you actually view "lecture00-graph-01.eps" in the
directory, with a postscript Viewer?

The last point, I think pdflatex (or pdftex) does not accept PS/EPS
formatted picture.  Can you latex trix.tex?  If so, try to save your
histogram as a PDF or PNG file, then pdflatex it again.

Cheers,

Kevin

------------------------------------------------
Ko-Kang Kevin Wang
Master of Science (MSc) Student
Department of Statistics
University of Auckland
New Zealand
www.stat.auckland.ac.nz/~kwan022



********************************************




More information about the R-help mailing list