[R-SIG-Mac] saving graphs; jpeg(), bitmap()

Tiago R Magalhaes tiago17 at socrates.Berkeley.EDU
Wed Dec 8 23:50:20 CET 2004

Dear Mac R-users

I want to export some plots. I have looked in the documentation and 
in the R-help archives. 2 main functions jpeg(), bitmap() are used, 
but I can't save any plots using them. (error logs at the end of the 
email). I'm using a PowerBook G4, Panther 10.3, R.2.1.

a) when using jpeg() I seem to be missing the X11 server. I have X11 
on my computer and it works fine. (XDarwin 1.3b4). On the R menu, 
under Miscillaneous there is a Run X11 server. When I lauch it 
reports an error:  "2004-12-08 22:24:13.082 open[10513] Couldn't 
launch application:  X11.app"

b) for using bitmap() I don't have the ghostscript file. Is it a mac 
file? Should I get it from somewhere?

c) I saved the files from the quartz device with the menu function. 
This solves the problem somewhat, but: I would like to save jpeg 
files. Even if I save pdf I would like to write it in a script. 
pdf() should do it, but I can only produce files with zero bytes 
using it...

d) and this is really just curiosity. The pdf file exported via menu 
is small (16kb) but when I open it in Photoshop and tell it to be 
300dpi becomes a big file (14Mb) and the quality is very good! I 
imagine this to be related to vectors instead of dots. I googled the 
terms, but there's nothing that mention pdfs as good grahp formats (I 
didn't do an extensive search, there were MANY documents, even trying 
to be very stringent)

Error in X11(paste("jpeg::", quality, ":", filename, sep = ""), width,  :
	unable to start device JPEG
In addition: Warning message:
unable to open connection to X11 display`'

bitmap('temp.jpg', type='jpeg', res='300')
/bin/sh: line 1: gs: command not found
Error in bitmap("temp.jpg", type = "jpeg", res = "300") :
	Sorry, gs cannot be found

More information about the R-SIG-Mac mailing list