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

Tiago R Magalhaes tiago17 at socrates.Berkeley.EDU
Thu Dec 9 04:54:53 CET 2004


Thank you all for replying to my email.  Rest assured that I realize 
that this is a luxury that I fully understand and appreciate.

I have written a long email with the details of my attempts to solve 
the problem. In very short: I couldn't yet write the files using the 
R console. I can export pdf files using the menu and those files have 
good quality for what I need - so if I can't solve this I will just 
export those files manually (a little more time consuming but 
definitely doable in my case)

I have written in all this detail, since I might be the type of 
person that you will end up getting a lot. (someone coming to R 
through microarrays, no background in computer science but willing to 
install the programs and willing to make an effort to have a basic 
understanding of what is happening, at least the basic concepts.)

a) I tried Rob's approach of having the Xserver running (little 
triangle on the dock).
I don't get an error any longer - it looks R is now recognizing and 
connecting to the X server. Unfortunately the file that is written is 
empty. It writes a file but it has 0 Kb (by the way, when giving the 
error it also writes the file 0Kb)

b) Simon Urbanek mentions that I should be running X11 from Apple. I 
thought the X11 I was running was from Apple. I clicked on the icon 
that was in the applications folder that has a big red X and it 
started running XDarwin and I assumed that that was the Apple's X11 
server. Apparenlty it isn't.

I had to open this X11 to use XEmacs (that I installed with fink). I 
have tried to look for that other Apple's X11 that should be in my 
computer but I cannot find it anywhere. Maybe my computer wasn't 
installed with that original Apple X11? Is that possible?

Trying Sys.setenv(DISPLAY=":0.0")  or sys.setenv(DISPLAY=":0.0") in 
my R gives the same message that the function doesn't work... (Simon 
asked me to that this)

I couldn't find the file ghostscript. There are 109 files with 
ghostscript on my computer, all in the fink folders. But none of them 
are the actual file (it's ghostscript info, patch, fonts, nox but 
nothing that seems the file itself). I installed i-installer but the 
installer.app is not there! (I sent the person an email about this). 
So I don't have the ghostscript file. If I have it, where exactly 
should I place it?

c) Stephan suggests "set the DISPLAY var on your own". I don't know 
what this means. I guess that is to link my X11 to R but I don't know 
how to do this.

d) I couldn't understand whether there is not a way besides the menu 
to save pdf files. Or all those methods are also dependent on the 
problems from above?

Again thank you all - Rob, Stefano, Simon, for the help and all the work.

########################
Rob's approach:
jpeg(file="./Books/Good/l1lsat.jpg")
op <- par(mfrow=c(1, 2))	# 1 row, 2 plots in this example
hist(rnorm(100))
boxplot(rnorm(25) , horizontal=T)
par(op)	# reset to previous par() settings
dev.off()



More information about the R-SIG-Mac mailing list