Hello
I wanted to post a reply to the message from Tiago R Magalhaes tiago17 at socrates.Berkeley.EDU .  
I had a need to save a R graph as jpeg file. Found Tiago's message very helpful.  However the exact sequence of commands did not work me.  In the interest of adding to this topic, here is what I had to do to save a R plot to a jpeg format file.  
R version: 2.10.1OS:  Mac OS Snow Leopard (10.6.3)HW: Mac Mini
Step 1) declare file name and file format in quartz() function.
    quartz(title="your plot title", file="your_plot.jpg", type="jpeg")
Step 2) create the plot as desired, for example
    plot(1:10)
Step 3) save the plot to the file specified in step 1.
    dev.off()
I did not find a lot of information online on this topic.  Hope this helps others,
NadeemDelaware ,USA
Tiago R Magalhaes tiago17 at socrates.Berkeley.EDU 
Thu Dec 9 17:58:25 CET 2004Previous message: [R-SIG-Mac] saving graphs; jpeg(), bitmap()Next message: [R-SIG-Mac] summary: MacOSX, Panther; save graphs, jpg(), pdf(), bitmap(), Ghostscript, X11 serverMessages sorted by: [ date ] [ thread ] [ subject ] [ author ]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 
problem.

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: 
http://www.apple.com/macosx/features/x11/download/

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.

example:
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:
bitmap()

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.


	[[alternative HTML version deleted]]

