[R] Can't save a graph to pdf in R for MacOS

p.b.pynsent p.b.pynsent at bham.ac.uk
Thu Jun 26 17:51:40 CEST 2003


Thank you for your helpful comments. You have indeed saved me time, 
when I started to document my reasons for the more tortuous route for 
generating pdf files they would seem now to be unnecessary.
Thus I have misled Sébastien Plante as pdf() works fine on my MacOS X 
10.2.6 but R 1.7.0.
Originally I had immense problems trying to get transparent 
backgrounds. e.g. ps.options(bg = "transparent") did not seem to work.
However this does work consistently now in using both eps and pdf 
formats. Although,

postscript("pdftest.eps")
ps.options(bg = "white")
... plotting bits
dev.off()

will produce an eps file with a transparent background the first time 
it is run after starting R but white on subsequent runs during the same 
R session. Whilst the sequence

ps.options(bg = "white")
pdf("pdftest.pdf")
.... plotting bits
dev.off()
will consistently produce a white background.
I imagine this is of little consequence to most people.

Lastly to answer your question about the R device driver bitmap(), I 
tried,
  bitmap("pdftest.pdf", type = "pdfwrite")
and got
Error: couldn't find function "bitmap"
so I presume NO.

Paul


 >
On Thursday, June 26, 2003, at 12:32  pm, Prof Brian D Ripley wrote:

> On Thu, 26 Jun 2003, p.b.pynsent wrote:
>
>> I do not have an R solution but use eps2pdf (a Perl script)
>> This can be installed by Fink
>> http://sourceforge.net/projects/fink/.
>
> eps2pdf runs GhostScript: so does the R device driver bitmap().  Does 
> the
> latter work on your system?  If so it would save you some steps.
>
>> On Wednesday, June 25, 2003, at 03:41  am, Sébastien Plante wrote:
>>
>>> Hi,
>>>
>>> I am using R 1.7.1 (carbon) for MacOS and I am running it on MacOS X
>>> 10.2.6. When I send a graph to the pdf device (or any other devices),
>>> I get a zero KB file name "Rplots.pdf".
>>>
>>> Before sending my graph to the output, I did:
>>>
>>>> dev.off()
>>>> pdf()
>>>> boxplot(... my graph commands...)
>>>> dev.off()
>>>
>>> Is this the correct procedure?  I did the same procedure on another 
>>> PC
>>> running Linux (R 1.6) and it work well.
>>>
>>> Please help!
>>>
>>> Thanks,
>>>
>>> Sébastien Plante
>>>
>>> ______________________________________________
>>> R-help at stat.math.ethz.ch mailing list
>>> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>>
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>
>>
>
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>


Dr. P. B. Pynsent,
Research and Teaching Centre,
Royal Orthopaedic Hospital,
Birmingham, B31 2AP, U.K.




More information about the R-help mailing list