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

David Winsemius dwinsemius at comcast.net
Sat Feb 13 21:11:50 CET 2010


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



More information about the R-SIG-Mac mailing list