[R] Questions about png() on Windows

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Sep 14 09:59:01 CEST 2003

*PLEASE* always use a subject line!

On Sun, 14 Sep 2003, Johannes Schnitzler wrote:

> for an interactive web application i need to produce a lot of graphics (up
> to 50) on demand.
> In the moment i'm using the png format.
> The png()
> ...using png(file="Rplot%03d.png", ...); 'plots' ; dev.off()... 
> produces very good graphics. The problem is it takes too long to produce the
> png files.
> The bitmap()
> ...using bitmap(file="Rplot%03d.png", type="type = "png256",...); 'plots';
> dev.off()...
> works really fast. But on my system the quality is poor compared with png()
> even with a higher resolution than 72.
> I'm using R 1.7.0 on Windows NT ; Ghostscript 8.00
> 1) Is there a possibility to speed up the png() 
>     or to improve the quality of the png produced by bitmap()

There is a possibility.  You have the source code, and we would be happy 
for you to optimize it and submit a faster version.  It looks up pixel 
values one at a time, and the use of block operations should speed it up.

> 2) How is it possible to give "names" to the png files (if producing more
> than one plot) instead of Name+serial number like Rplot%03d.png 

Just start a new device for each plot!

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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list