[R] Vector format importation from R to OpenOffice

Philippe Grosjean phgrosjean at sciviews.org
Tue Apr 22 15:33:01 CEST 2008


Hello Agustin, hi all,

There was a recent discussion about how to import R graphs in vector 
format into OpenOffice. For Microsoft Word under Windows, there is no 
problems: the EMF format (Windows Enhanced Metafile) is completely 
supported. However, importing the same .emf file into OpenOffice leads 
to very poor results.

Here is a workaround, until OpenOffice will support PDF format (in next 
release):

- Install ghostscript and pstoedit (http://www.pstoedit.net/pstoedit).

- From R, create a graph in PDF format, or export it in PDF. This is 
very convenient format to store all your graphs because you can easily 
view, zoom in/out, etc. you graph in your favorite PDF viewer on any 
platform. It is much more portable than EMF.

- Convert your PDF files into a "OpenOffice-compatible" Windows Metafile 
at the command line:

 > pstoedit -f "wmf:-OO" graph.pdf graph.wmf

- Import graph.wmf into OpenOffice.

I just did a few trials with graphs from demo(graphics). The results are 
much, much better that the original EMF version generated by R, and it 
is also more compact. For reasons, I ignore, WMF generated by pstoedit 
seems better than EMF, and even, than SVM (the OpenOffice vector 
format)! Yet, some experimentation with pstoedit numerous formats and 
options before getting the best import of R graph into OpenOffice 
remains to be done...
Best,

Philippe Grosjean

P.S.: if someone got time, it would be nice to put this on the R Wiki...

Agustin Lobo wrote:
> Just in case you did not see this thread:
> 
> from
> https://stat.ethz.ch/pipermail/r-help/2008-April/160141.html
> 
> ...
> As there is no real solution to this problem, I wonder if
> developers of R graphic GUIs could consider adding
> SVG format as one of the available formats to the "Save As" tab of R
> graphic GUIs
> (according to my web search, problems at importing emf files by OpenOffice
> have been reported since so long ago that there is little hope that this
> problem will
> ever be solved within Open Office).
> 
> Thank you all.
> 
> Agus
>



More information about the R-help mailing list