[R] Graphics output device

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Oct 6 14:30:52 CEST 1999


> Date: Wed, 06 Oct 1999 19:58:49 +0800
> From: Li Dongfeng <mavip5 at inet.polyu.edu.hk>
> 
> 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.

Surely all saved graphs should be portrait?: landscape implies
a 90% rotation.

> 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.

There is a more general solution along these lines in the function
dev2bitmap in 0.65.1, which is due for release in a few hours time.  In
particular, it allows other output sizes, resolutions and formats.
paper="special" in postscript() makes the paper size equal to the
device region, in that version.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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