[R] alpha-channel transparency in filled.contour
Brant Carlson
brantc at stanford.edu
Thu Aug 31 22:03:13 CEST 2006
Greetings
I am currently using R to produce contour plots of a given variable via
"contour", together with a hacked* version of filled.contour to shade
several regions of the plot. As the regions overlap, I am using
colors with alpha-channel values of ~0.1 together with the pdf device
(version="1.4").
The transparency works well. However, a white grid is superimposed over
all the drawn regions. Simplified code to reproduce the grid effect is
below.
An earlier attempt to draw the regions with "rect" had a similar
problem, which was fixed by setting the density parameter to -1 to
disable shading. The filled.contour function has no such parameter, nor
does the .Internal call to "filledcontour" used to actually draw the contours in
my hacked version.
Is there an easy way to fix this (like some other way to set the density
parameter), or another way to draw a filled region between two levels in
a contour plot that would allow for alpha-channel transparency?
Much Thanks.
Brant Carlson
*: the "hacked" version merely deletes the code that changes the margins
and draws the key.
#code to reproduce grid effect:
pdf("deleteme.pdf",version="1.4")
y <- matrix(1:100,nrow=10,ncol=10)
filled.contour(y,col=c(0,rgb(1,0,0,0.1)))
dev.off()
More information about the R-help
mailing list