[R] Graphics output device

Li Dongfeng mavip5 at inet.polyu.edu.hk
Wed Oct 6 13:58:49 CEST 1999



Terry Westley wrote:
> 
> On Friday, October 01, 1999, Prof Brian D Ripley wrote:
> > You don't tell us the platform you are using, but I guess Unix (because of
> > xv). Powerpoint only runs on Windows to my knowledge, and the Windows
> > version of R already has saves to the sort of files Powerpoint likes, for
> > example Windows metafiles and .gifs.  Because you can use the
> > vector-format
> > metafiles this avoids multiple rasterization effects. (It would be not at
> > all easy to do wmf on Unix versions of R.)
> >
> > R 0.65.1 will have a savePlot function in Windows (and rwtest999 does
> > already) to effectively select the menu option to do so.
> 
> I agree with Michael Lapsley that Unix R needs the ability to write
> some graphic file format.  My application runs on (Sparc) Solaris,
> so generating and printing Postscript files is convenient most of
> the time.  But, very often, my users want to take the output and
> put it in Powerpoint.  (There's no way they will use LaTeX.) Also,
> you can expect people to want, more and more, to put plots in web
> pages (see http://www.math.montana.edu/Rweb/ for example).
> 
> It's not pretty, but my solution was adapted from what Jeff Banfield
> did with Rweb:
> 
> 1) generate postscript file in R
> 2) convert to ppm with ghostscript
> 3) use pnm utilities to convert to gif
> 

I use two steps to make PNG graphics from R code for
dynamic web publishing:

1) Generate postscript file with R code,
   but use a patched R. I patched the R source
   (src/unix/devPS.c) to add a new paper size which 
   is smaller(595x421) and is in landscape orientation
   naturally.
2) Convert the postscript file to PNG format 
   using ghostscript:
   gs -dQUIET -dBATCH -dNOPAUSE \
     -dDEVICEWIDTH=595 -dDEVICEHEIGHT=421 \
     -sDEVICE=png256 -sOutputFile=filename.png psfile.ps

This solution requires newer version browsers because PNG
format is not supported in old browsers,
but only need R and ghostscript, no other tools needed.

> Anyone who wants more detail may write me, or you can download
> Jeff's Rweb code.
> 
> My preference would be that the Unix versions of R be capable
> of performing a savePlot function to pnm format or directly
> to gif or png.
> 
> --
> Terry J. Westley, Software Systems Engineering Supervisor
> Veridian Engineering, Calspan Operations
> P.O. Box 400, Buffalo, NY 14225
> twestley at buffalo.veridian.com    http://www.veridian.com
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list