[R] Transparent backgrounds in png files

Patrick Connolly p.connolly at hortresearch.co.nz
Fri Jul 30 02:24:20 CEST 2004

On Thu, 29-Jul-2004 at 08:38AM +0100, Prof Brian Ripley wrote:

|> The bitmap() device does not support transparency.  The png() device does.

Unfortunately, though png() does a fine job at a transparent
background, it's rather lumpy even on a screen.

|> On Thu, 29 Jul 2004, Patrick Connolly wrote:
|> > Mine is the reverse (and I'm using standard graphics, not Lattice).
|> > I'm trying to get a transparent background but it always comes out
|> > white.  Setting bg = "transparent", I've tried using a bitmap device
|> > to create a png file.  I've also tried creating a postscript file and
|> > converting it to a PNG file using the Gimp.  I've always used a
|> > resolution of 300 dpi in bitmaps since the default is far too low.
|> Really?  You want PNG files of 2000+ pixels in each dimension?  

Well, 300 dpi is somewhat excessive for onscreen, but not for printing
(more below).  For a screen at 1600 by 1200 resolution, a bitmap of
over 1000 pixels in either direction is not excessive.  Using a screen
rated at .25mm dot pitch, 75dpi is rather a lot less than sufficient.
According to my calculations, .25mm dot pitch corresponds to over 100
dpi, and a .27mm screen is over 90 dpi, so I don't get this 72
business.  Perhaps there's something I need to know.

Evidently, there's something others know that I don't since png()
generated files always turn out lumpy for me.  It's worse than the
unsatisfactory result of using PowerPoint's turning colours to
transparent method I mentioned.  People who are used to looking at TV
screens might not think it's low resolution, so perhaps I'm too fussy.

Maybe I should be more fussy about getting an exact ratio between the
number of pixels in the plotting device and the size of the image in
PowerPoint.  I'm somewhat confused by the fact that PP scales to fit
to the slide PNG files that I produce using the Gimp, but not ones
made using the png() method directly.  What is the essential

|> -- and you should not really be using bitmapped files for other
|> uses.)

Unfortunate as it may be, many people wish to put graphics in Word
files and don't like being unable to see their graphics on their
screen even if they have a postscript printer that could print them
perfectly.  That's where I use 300 dpi PNGs which print at least as
well as WMFs I've seen.

There was a recent discussion on this list about graphics using OSX
which covers most of the same thinking.  Nothing in that discussion
indicated to me a better way to get graphic files from Linux to Word.
If there are any, I'd like to know about them.


Patrick Connolly
Mt Albert
New Zealand 
Ph: +64-9 815 4200 x 7188
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright 

More information about the R-help mailing list