[R] help for high-quality plot (wmf) in files

Kuhn, Max Max.Kuhn at pfizer.com
Tue Sep 18 23:02:45 CEST 2007


> Standard sweave may not work for this, but there is the odfWeave
package
> that will create openoffice documents which can easily be converted to
> word docs (I have used this for creating sets of graphs to send to
> clients who only use word).  I don't know if it can generate .wmf
files
> or not, but it does produce pretty good quality graphics (best if you
> specify up front what size you want the graphs to be).

Here is an example:

   currentPlotDef <- getImageDefs()

   currentPlotDef$device <- "win.metafile"
   currentPlotDef$type <- "wmf"
   currentPlotDef$plotHeight <- 7
   currentPlotDef$plotWidth<- 7

   setImageDefs(currentPlotDef)

   demoFile <- system.file("examples", "simple.odt", package =
"odfWeave")

   odfWeave(demoFile, "c:\\wmfTest.odt")

You can also add figure captions to each image in case that helps. There
is a file called "formatting.odt" in the package examples directory that
explains how to use the package (in addition to the man pages). 

Nore that the resulting odt file is a compressed archive and the raw
images are stored in a sub-directory called Pictures.

Potential statement of the obvious: the win.metafile driver is not
available on all platforms (it may be windows only).

Max



More information about the R-help mailing list