[R] exporting graphics

Marc Schwartz (via MN) mschwartz at mn.rr.com
Tue Mar 21 00:17:31 CET 2006


On Mon, 2006-03-20 at 17:33 -0500, tkobayas at indiana.edu wrote:
> Hi,
> 
> This is a very fundamental question. I want to export graphical results 
> so that I can place them in an openoffice document.

>  I use Fedora 5. 

That was quick... ;-)

The best way to do this under Linux is to use the R postscript()
function to create an Encapsulated PostScript file (EPS) and then import
that into OO.org.

See ?postscript and pay particular attention to the Details section,
which defines that you should use the following arguments to
successfully create an EPS file for use in this fashion:

postscript(file "YourEPSFile.eps", horizontal = FALSE, onefile = FALSE,
           paper = "special", ...)

The additional key arguments that you will need to pay attention to are
the 'height' and 'width' arguments to specify the dimensions of the
graphic that you desire. These should be set "close to", if not exactly,
the actual size that you require in your document.

Note that when you import the file into OO.org, a bitmapped preview of
the R graphic image will be created. This preview will be low quality
and suitable for aiding placement, but not really for viewing the
graphic.

However when the document is printed to a Postscript (PS) file or
printer, using a PS compatible printer driver, the output will be of
high quality. 

If you need a PDF file created, you can then use 'ps2pdf' to create it,
or if you have set up the 'PDF Converter' printer in OO.org using
'spadmin', you can use this as well (presuming that they kept this in
5). 

At least through FC4, the PDF Export function (the PDF icon on the
toolbar) did not properly print embedded EPS files. The lower quality
bitmapped preview image is what gets printed.

HTH,

Marc Schwartz




More information about the R-help mailing list