Thank you Paul Murrel for answering and thank you Brian Ripley for correcting this behaviour in R-patched.

I am sorry, but I think there is just another 'misfeature' with transparent figures since R-2.4.0 and it seems not to be corrected in todays R-2.4.0 Patched (2006-11-24 r39989).

In earlier versions when producing a transparent figure without any border (=NA), nothing was drawn. In newer versions there is something like a white border line. You can see it in particular when drawing a new dotted line above this border of the underlying figure. I should demonstrate it with a small example:

--------------------------------------------------------------------
pdf("test_alpha.pdf", 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)

# 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=NA)
lines(c(4,4,7,7,4), c(4,7,7,4,4), col="red", lty=2)
text(5,7, "no transparency")

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

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

It is probably just a mistake. What do you think?

Rainer Hurling



Paul Murrell schrieb:
Hi

This appears to have been fixed in r-patched (by Brian Ripley)

Paul


Rainer Hurling wrote:
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

pdf("test_alpha.pdf", 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)

# 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=NA)
lines(c(4,4,7,7,4), c(4,7,7,4,4), col="red", lty=2)
text(5,7, "no transparency")

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

#for (x in 1:8) 
#  for (y in 1:8) 
#    rect(x-0.5,y-0.5, x+0.5, y+0.5, col=rgb(255,193,37, 255/(x*y), max=255))

#rect(5,5,7,7, col=rgb(255,0,0, 255, max=255), border=NA)

dev.off()
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to