Hello, I'm having trouble with using the alpha channel for transparency with lines with lattice levelplots.
If I use transparency via the alpha argument to rgb to overplot lines on levelplot the transparent colour affects all of the region colours in the plot. Can anyone explain why the difference in region colours? #### Warning: this code attempts to create PDF files in working directory - they may be downloaded, see below library(lattice) ## prepare data data(volcano) xy <- expand.grid(x = 1:nrow(volcano), y = 1:ncol(volcano)) xy$z <- as.vector(volcano) ## panel function to add lines with grey(0.3) my.panel <- function(...) { panel.contourplot(...); panel.xyplot(1:60, runif(60, 1, 60), type = "l", lwd = 3, col = grey(0.3)) } ## this works fine pdf("plot.pdf", version = "1.4") levelplot(z~x+y, xy, panel = my.panel) dev.off() ## panel function to add lines with grey transparency my.paneltransp <- function(...) { panel.contourplot(...); panel.xyplot(1:60, runif(60, 1, 60), type = "l", lwd = 3, col = rgb(0.3, 0.3, 0.3, 0.5)) } ## this results in grey bleeding on the coloured regions of the plot pdf("alpha.pdf", version = "1.4") levelplot(z~x+y, xy, panel = my.paneltransp) dev.off() I've put the pdfs created here for reference: http://staff.acecrc.org.au/~mdsumner/R/ Cheers, Mike. I'm using Windows XP, SP2: sessionInfo() R version 2.4.1 (2006-12-18) i386-pc-mingw32 locale: LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252 attached base packages: [1] "stats" "graphics" "grDevices" "utils" "datasets" "methods" [7] "base" other attached packages: lattice "0.14-16" ______________________________________________ R-help@stat.math.ethz.ch 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.