[R-SIG-Mac] Problems with savePlot() and postscript under Snow Leopard

David Winsemius dwinsemius at comcast.net
Sat Feb 13 23:04:16 CET 2010


On Feb 13, 2010, at 4:08 PM, Hannes Nietnagel wrote:

> Thanks David for your reply!
>
>
>> species.n <- as.numeric(iris$Species)
>> png("test.png")
>> plot(iris, col = species.n)
>> dev.off()
>
> 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 think it is telling you which graohics device is open for plotting.

> I
> still cannot produce a decent .eps file.
>

 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.

-- 
David.
> Thank you!
>
> Hannes
>
>
>
>
> 2010/2/13 David Winsemius <dwinsemius at comcast.net>:
>>
>> On Feb 13, 2010, at 2:53 PM, David Winsemius wrote:
>>
>>>
>>> On Feb 13, 2010, at 1:51 PM, Hannes Nietnagel wrote:
>>>
>>>> Dear all,
>>>>
>>>> since my problem could not be solved in the general R mailing list,
>>>> I'll post the issue again in this specific mailing list.
>>>>
>>>> I tried:
>>>>>
>>>>> iris
>>>>> species.n <- as.numeric(Species)
>>>
>>> It would help if yuo access the column properly. "Species" is only
>>> meaningful within "iris".
>>>
>>>>> plot(iris, col = species.n)
>>>>> savePlot(filename="IrisTestPlot", type="png")
>>>
>>> If you want a png plot then open the png() device and close it  
>>> when you
>>> are done:
>>>
>>> species.n <- as.numeric(iris$Species)
>>> png("test.png")
>>> plot(iris, col = species.n)
>>> dev.off()
>>>
>>> Produces the requested plot in the working directory and Preview  
>>> opens it
>>> without problem.
>>
>> I also got a slightly different sort of success with:
>>
>> plot(iris, col = species.n)
>> quartz.save("test2.png", type="png")
>>
>> The background was completely transparent. I can see useful  
>> application of
>> that feature in creating "after-the-fact" overlays of other plots.  
>> Reviewing
>> the help page for ?quartz, it appears this is the expected result.  
>> Plotting
>> with the png() device created a white background (as would be  
>> expected after
>> reading its help page.)
>>
>> --
>> David.
>>>>
>>>> and got the error message:
>>>> Fehler in savePlot(filename = "IrisTestPlot", type = "png") :
>>>> kann nur aus 'X11(type="*cairo")' Devices kopieren
>>>>
>>>> (sorry, I have a german version of R).
>>>>
>>>> I tried:
>>>>>
>>>>> postscript("IrisTestPlot.eps",
>>>>> paper="special",height=6,width=6,onefile=FALSE,horizontal=FALSE)
>>>>
>>>> and
>>>>
>>>>> postscript(file="IrisTestPlot2.pdf", onefile = FALSE, horizontal =
>>>>> FALSE, paper = "special", width = 8, height = 8)
>>>>
>>>> in both cases there are files produced that cannot be opened. Error
>>>> message: the bounding box is missing.
>>>>
>>>>
>>>> According to Michael's advice I tried:
>>>>>
>>>>> quartz.save("IrisTestPlotquartz.png","png")
>>>
>>>> and got:
>>>> postscript
>>>>      5
>>>>
>>>> but no file.
>>>>
>>>> as well as:
>>>>>
>>>>> system('open IrisTestPlotquartz.png')
>>>>
>>>> It states that the files does not exist.
>>>>
>>>> And I tried:
>>>>>
>>>>> plot(iris)
>>>>> dev.cur()
>>>>
>>>> And got the answer:
>>>> postscript
>>>>       3
>>>> and again no file.
>>>>
>>>>
>>>>
>>>> I use 64 bit R under Snow Leopard.
>>>>
>>>>> sessionInfo()
>>>>
>>>> R version 2.10.1 (2009-12-14)
>>>> x86_64-apple-darwin9.8.0
>>>>
>>>> locale:
>>>> [1] de_DE.UTF-8/de_DE.UTF-8/C/C/de_DE.UTF-8/de_DE.UTF-8
>>>>
>>>> attached base packages:
>>>> [1] stats     graphics  grDevices utils     datasets  methods    
>>>> base
>>>>
>>>> loaded via a namespace (and not attached):
>>>> [1] tools_2.10.1
>>>>
>>>>
>>>> What could be the problem and how can I solve it?
>>>> Thank you very much in advance for your time and advices!
>>>>
>>>> Hannes
>>>>
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac at stat.math.ethz.ch
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>
>>> David Winsemius, MD
>>> Heritage Laboratories
>>> West Hartford, CT
>>>
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
>> David Winsemius, MD
>> Heritage Laboratories
>> West Hartford, CT
>>
>>
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list