[R] Cross-platforms solution to export R graphs

Philippe Grosjean phgrosjean at sciviews.org
Fri Apr 10 14:54:44 CEST 2009


To further add to this discussion. I would like to propose 
**cross-platform** solutions, emphasizing that the proposed solutions 
should work on Windows, Mac OS X and Ubuntu, at least.

First of all, inclusion of a simple EPS graphs produced by R 2.9.0 with:

 > setEPS(); postscript("TestGraph.eps", width = 7, height = 7)
 > hist(rnorm(500), col = "yellow")
 > dev.off()

systematically crashes native OpenOffice 3.0.1 (build 9379) on my Mac OS 
X 10.4. When I try to recover the document, it crashes again. The 
document is lost (impossible to get the rest of it when the EPS file in 
included)! Further experience is probably needed, but I cannot recommend 
a solution that does not work on my Mac test machine.

Further arguments against EPS:
- No support of semi-transparent colors (rarely used, but...)
- It is the bitmap version that is displayed in the OOo document => not 
optimal in comparison with the use of EMF files, or with import into 
native shapes from PDF. This is particularly important because the PDF 
documents produced from OOo apparently also display the bitmap version 
of the EPS. Not nice when the intended result is in PDF form. It is then 
easier to use PNG files.

Obviously, further experimentation is required here.

Best,

PhG


Philippe Grosjean wrote:
> Emmanuel Charpentier wrote:
>> Le jeudi 09 avril 2009 à 15:04 +0200, Philippe Grosjean a écrit :
>>> Hello Rusers,
>>>
>>> I have worked on a R Wiki page for solutions in exporting R graphs, 
>>> especially, the often-asked questions:
>>> - How can I export R graphs in vectorized format (EMF) for inclusion 
>>> in   MS Word or OpenOffice outside of Windows?
>>> - What is the best solution(s) for post-editing/annotating R graphs.
>>>
>>> The page is at: 
>>> http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export.
>>>
>>> I would be happy to receive your comments and suggestions to improve 
>>> this document.
>>
>> Well, if you insist ...
>>
>> The PDF import plugin in OpenOffice is still beta, and some report deem
>> it difficult to install correctly an/or flaky.  Having checked that both
>> MSWord (>=2000) and OpenOffice (>=2.4) import and display correctly (i.
>> e. vectorially, including fonts) EPS files, I switched to this format,
>> most notably for use with the marvellous Max Kuhn's odfWeave package,
>> which is a *must* for us working in state/administrative/corporate salt
>> mines, where \LaTeX is deemed obscene and plain \TeX causes seizures ...
>> The point is that this format doesn't need any intermediary step, thus
>> allowing for automatisation. Be aware, however, that the embedded EPS
>> images are not editable in-place by OpenOffice nor, as far as I know, by
>> MS Word. But my point was to *avoid* post-production as much as humanly
>> possible (I tend to be inhumanly lazy...).
> 
> Ok, I understand your point of view. I tend to consider PDF import buggy 
>  in early trials, but now, the beta version seems fine and easy to 
> install on all tested platforms.
> 
> Also, using odfWeave and avoiding post-edition of graphs as much as 
> possible is certainly the best practice.
> 
> However, when you use EPS, you need a postscript printer to render the 
> graphs. So, this is an additional constraint to consider.
> 
> I will emphasize a little bit more the qualities of EPS in the document.
> 
> Thanks.
> 
> PhG
> 
>> HTH,
>>
>>                     Emmanuel Charpentier
>>
>>> All the best,
>>>
>>> PhG
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list