I read in a thread in r-help today that the windows device in 2.6 supports transparency, so I tried an example and had some issues. The density plots should be filled with transparent color in the following example (similar to the points), however the color is "fully" transparent. This works in the Cairo device, but not in the windows device.
Thanks, --Matt Matt Austin Statistician, Amgen Inc. Example of problem derived from example(layout) code. ##Start windows() x <- pmin(3, pmax(-3, rbeta(5000,1,5))) y <- pmin(3, pmax(-3, c(rnorm(2500, .25, 1), rnorm(2500))) ) trtp.f <- factor(rep(c("Placebo", "Not Placebo"), each=2500), levels=c("Placebo", "Not Placebo")) xdens <- tapply(x, trtp.f, density, na.rm=TRUE) ydens <- tapply(y, trtp.f, density, na.rm=TRUE) topx <- max(unlist(lapply(xdens, function(x) max(x$y)))) topy <- max(unlist(lapply(ydens, function(x) max(x$y)))) xrange <- range(x, na.rm=TRUE) yrange <- range(y, na.rm=TRUE) nf <- layout(matrix(c(2,0,1,3),2,2,byrow=TRUE), c(3,1), c(1,3), TRUE) par(mar=c(4,4,0,0), oma=c(0,0,0,0)) getcolors <- rainbow(length(levels(trtp.f)), alpha=.5) plot(x, y, xlim=xrange, ylim=yrange,xlab="X value", ylab="Y value", pch=21, bg=getcolors[as.numeric(trtp.f)]) par(mar=c(0,4,1,1)) plot(x=xrange, axes=FALSE, xlim=xrange, ylim=c(0, topx), xlab="", ylab="") #lapply(xdens, lines) for(i in 1:length(xdens)){ dat <- xdens[[i]] polygon(x=c(min(dat$x), dat$x, max(dat$x)) , y=c(0, dat$y, 0), col= rainbow(length(xdens), alpha=.5)[i]) } par(mar=c(4,0,1,1)) plot(x=yrange, axes=FALSE, ylim=yrange, xlim=c(0, topy), xlab="", ylab="") for(i in 1:length(ydens)){ dat <- ydens[[i]] polygon(y=c(min(dat$x), dat$x, max(dat$x)) , x=c(0, dat$y, 0), col=rainbow(length(ydens), alpha=.5)[i]) } ##End Other Info: platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status RC major 2 minor 6.0 year 2007 month 09 day 26 svn rev 42991 language R version.string R version 2.6.0 RC (2007-09-26 r42991) [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel