[R] How to use alpha transparency channel for colors?

kwright@eskimo.com kwright at eskimo.com
Thu Oct 7 17:01:16 CEST 2004


The release notes for R 2.0.0 states:

  It is now possible to specify colours with a full alpha
  transparency channel via the new 'alpha' argument to the
  rgb() and hsv() functions, or as a string of the form "#RRGGBBAA".

  NOTE: most devices draw nothing if a colour is not opaque,
  but PDF and Quartz devices will render semitransparent colours.

  A new argument 'alpha' to the function col2rgb()
  provides the ability to return the alpha component of
  colours (as well as the red, green, and blue components).

I'm using R 2.0.0 on Windows 2000 and wanted to try this feature.  The
following simple test works fine:

pdf("c:/alpha.pdf")
plot(rnorm(1:100),rnorm(1:100),col="#000055ff",pch=16)
dev.off()

But as soon as I change alpha value from "ff" to "fe", the points are no
longer visible for me.  I've tried viewing the pdf with Acrobat Reader
5.1.0 and gsview4.5.

Do I need a more recent pdf viewer?  Is this feature not working on
Windows?  Am I doing something wrong?  Any tips would be appreciated.

Thanks,

Kevin Wright




More information about the R-help mailing list