[R-SIG-Mac] summary: MacOSX, Panther; save graphs, jpg(), pdf(), bitmap(), Ghostscript, X11 server

Tiago R Magalhaes tiago17 at socrates.Berkeley.EDU
Thu Dec 9 17:58:25 CET 2004

So after taking some time and bothering some people (Thanks very much 
to all of them: Simon Urbanek, Rob J Goedman, Stefano Iacus, Byron 
Ellis, Elijah Wright, Denis Chabot, Nathan Weisz) I solved the 

I decided to write this summary. It's kind of long, but it might be 
helpeful to someone else.

Two problems: installation and knowledge on how to use R. This is 
valid for Panther 10.3.6, R 2.01 in a PowerBookG4.

I) Installation

X11 server has to be running. Go to Misc, Run X11 Server. You have to 
have X11 installed in your computer. Some Macs don't have it 
installed. It's on the 3rd CD. You can also download it from: 

2) Saving graphs:
jpeg(), png(), pdf()

a) You have to have X11 running. Go to Misc, RunX11 server, let X11 
opened, don't close it.

b)to save a file you first have to open a device.
this was confusing to me, so let me be clear for other people like 
myself (supposing I am not the only one having this problem...).

jpeg() and png() pdf() are NOT used to save plots AFTER the plots are 
done. That's not what they do.

jpeg("myfile.jpg")   #opens a device - saves a file in your directory 
but it has 0 Kb
plot(1:10)               #places the plot in the device - still 0 Kb 
file in your directory
dev.off()                  #closes the device and saves the contents 
of the plot in file.
                                 #you now have a file

3) there is another way to save graphs:

for that you need to have Ghostscript installed. I dowloaded 
Ghostscript, but using bitmap() sill does't work, it still can't find 
Ghostscript, I don't know where I have to install it, but I don't 
really need it.

General considerations:
a) It's always possible to save pdfs files from the active device on 
the menu: file > save
b) cut and paste also works
c) pdfs are wonderful for graphs and lines. I was surprised by the 
quality and the small size of the file. Another show of my ignorance.
d) I am very surprised that this has not been an issue. I think the 
functions are not very intuitive and the help pages, although clear 
NOW, didn't help me that much when I first read them.
e) I'm curious about this on windows. Do they also go through this 
device process?
f) you people are wonderful. Thanks for all the support and the help 
that I have had. It was a little time consuming but I've learned a 
lot in the process.

More information about the R-SIG-Mac mailing list