[R] transparent colors
Greg.Snow at intermountainmail.org
Wed Oct 10 19:08:23 CEST 2007
It can be as simple as:
> plot( rnorm(1000), rnorm(1000), col="#0000ff22", pch=16,cex=3)
Where the color is "#RRGGBBAA" and the AA portion is the
opacity/trasparency. Of course this only works if you are using a
graphics device that supports transparency. The windows device under R
2.6.0 does (but not any previous versions), the Cairo device does, the
PDF device does (as long as you set the correct options), and I think
the default device on Macs does, I don't know which others do.
The rgl package has another way of doing this (but may be overkill for
If you are interested in plotting lots of points, look at the hexbin
package (bioconductor I think) for an alternative way of presenting the
Hope this helps,
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at intermountainmail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Markus Loecher
> Sent: Wednesday, October 10, 2007 9:48 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] transparent colors
> Dear R graphics experts,
> Do you know of any way of plotting semi-transparent points in R ?
> I face this problem any time I want to e.g. plot thousands of
> points that belong to two or three classes which I color code.
> With the default opaque colors, the plotting order matters
> and basically the points I plot last completely dominate the
> picture. I would much rather have the overlaying points mix in color..
> Thanks a lot,
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help