[R] Postscript graphs

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Jan 26 09:27:53 CET 2010


On Mon, 2010-01-25 at 14:05 -0800, Lu Wang wrote:
> Hi,
> 
> I tried to use the following commands to create a postscript pie chart using R:
> 
> postscript(file="H:/piechart.eps")
> # then I wrote my commands to generate the pie chart
> pie(filename,labels=,col=,radius=0.6)
> dev.off()
> 
> After I ran those commands, instead of giving the pie chart, it showed 
> > dev.off()
> postscript 
>          2 
> > 
> In my H drive, there is a file called piechart.eps, but I want to look
> at it. Is there any way I can see the figure and import it to word or
> pdf file? I am writing a paper that needs this graph. It would be more
> helpful If I can see it.

Word accepts eps files - did you try importing it? (It may look rubbish
on screen as it displays a low-res preview of the figure and in my
experience doesn't do a very good job on the preview, but it will print
on a postscript printer at high quality, as it will on any printer when
converted your word files is converted to PDF.)

You also need to add some arguments to your postscript call to get EPS:

postscript(file="H:/piechart.eps", height = X, width = Y,
           onefile = FALSE, paper = "special")

With X and Y your desired heights in inches.

GSView is a application that also runs on Windows that allows you to
open, view and convert postscript and EPS files. It requires the
Ghostscript interpreter to be installed as well.

How are you producing a pdf? Without knowing that it is difficult to say
how to import your postscript figure into it.

HTH

G

> 
> Thanks,
> John
> 
> 
> 
>       
> 	[[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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list