[R] alphachannel on pdf-device

Rainer Hurling rhurlin at gwdg.de
Tue Nov 14 19:47:01 CET 2006


Dear R users,

since R-2.4.0 I am not able any more to draw figures without 
transparency after drawing one figure with alphachannel set lower than 100%.

For better unterstanding here a small example of my problem:


-----------------------------------------------
pdf(paste("test_alpha_rgb.pdf",sep=""), version="1.4")

plot(1:8, 1:8, type="n", xlab="", ylab="")

lines(c(1,8), c(1,8), type="l", col="lightblue", lwd=15)

# polygon with alphachannel=64 (transparency 40%)
polygon(c(5,2,2,5,5), c(2,2,5,5,2), col=rgb(255,192,203,64, max = 255), 
border=NA)
text(4,2, "transparency 40%")

# rectangle with alphachannel=255 (no transparency)
goldenrod1 <- rgb(255,193,37,255, names=c("goldenrod1"), max=255)
rect(4,4,7,7, col=goldenrod1, border=goldenrod1)
text(5,7, "no transparency")

dev.off()
-----------------------------------------------


In this example (see pdf in attachment) after plotting a line without 
any transparency a polygon is drawn with alphachannel set to 40%. All 
following figures and even text is shown with transparency.

The described behaviour seems to be the same on FreeBSD 7.0-CURRENT and 
on WindowsXP.

Am I doing something wrong?

Many thanks for any help,
Rainer Hurling

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_alpha_rgb.pdf
Type: application/pdf
Size: 3527 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20061114/b7fe8648/attachment.pdf 


More information about the R-help mailing list