Skip to content

Problems with savePlot() and postscript under Snow Leopard

6 messages · Hannes Nietnagel, David Winsemius, Brian Ripley

#
Thanks David for your reply!
That works fine for the png. But I still get the message:
postscript
        3

What does it mean? Is there something wrong with my postscript? I
still cannot produce a decent .eps file.

Thank you!

Hannes




2010/2/13 David Winsemius <dwinsemius at comcast.net>:
#
On Feb 13, 2010, at 4:08 PM, Hannes Nietnagel wrote:

            
I think it is telling you which graohics device is open for plotting.
From a fresh R session:

 > ?quartz
starting httpd help server ... done
 > ?postscript
 > species.n <- as.numeric(iris$Species)
 > png("test.png")
 > plot(iris, col = species.n)
 > dev.off()
null device
           1
 > postscript("test.eps")
 > plot(iris, col = species.n)
 > dev.off()
null device
           1

I now have two files in my working directory (albeit with different  
aspect ratios). The test.eps file can be read by Preview although it  
needs to be converted to pdf to be displayed,  and then appears  
perfectly normal to me. The help page for postscript() says that  
single plots are eps by default, so I just named it to correspond to  
htat promise. If you post the console message and describe more fully  
what you mean by "cannot produce a decent .eps file", someone might be  
able to comment more fully.
#
On Feb 13, 2010, at 5:04 PM, David Winsemius wrote:

            
One the other hand, efforts to insert that file into an OpenOffice.org  
presentation file results in an error: "Unknown graohic format".  
However, adding 2 out of 3 of the recommended arguments does result in  
a file that can be inserted. I'm not sure what is wrong either with  
the three argument effort (see below) or just using the "file="  
argument approach.

 > postscript(file="test.eps",horizontal = FALSE, onefile = FALSE)
 > plot(iris, col = species.n)
 > dev.off()
null device
           1

When I try with all three arguments I get an error:

 > postscript(file="test.eps",horizontal = FALSE, onefile = FALSE,  
paper = "special")
 > plot(iris, col = species.n)
Error in plot.new() : figure margins too large
#
Perfect! Thanks! That works! I tried all your suggestions and got the
same messages like you. In any case, I get png as well as eps. So I
can work with R now.

Again thank you very much for your time and advices!


Hannes



2010/2/13 David Winsemius <dwinsemius at mac.com>:
#
On Sat, 13 Feb 2010, David Winsemius wrote:

            
You did not specify the size of the 'special' paper: use width=, 
height=.

If you just use file= you

1) may get a rotated plot (and will if the factory-fresh default for 
horizontal= is in place).
2) get a header that does not declare this is EPS, and some including 
applications will fail to include it (properly or at all).
3) get a plot with margins on the default paper size (A4 or US 
letter), which is not what one wants for inclusion.
#
On Feb 15, 2010, at 3:47 AM, Prof Brian Ripley wrote:

            
Thank you. Adding the height and width arguments to the last device  
call succeeds in creating a file which OO.org's Impress program is  
able to insert.

It is no longer readable by Preview.app, however. I am surmising that  
Preview is only able to read postscript files that are "complete" in  
some sense.