Stefan Grosse said the following on 1/11/2008 10:04 AM: > Dear useR's, > > I have a problem with the lattice plotting of some symbols: > > library(lattice) > > test<-data.frame(x=c(2,3,1,5),u=c(rep(1,2),rep(2,2)),g=c(rep(c(1,2),2))) > > xyplot(x~u,groups=g, > data=test, > par.settings=list( > superpose.symbol=list(pch=c(22, 23),cex=c(1.7,1.6),col="black") > ), > key=list( > text=list(c("t1","t2")), > space = "bottom",pch=c(23, 22), > points=F, > cex=1.0, > col="black" > ), > ) > > As you see the symbols which have been plotted into the plotting area appear > to have some filling color while in the legend there is no filling color > although the specification of the symbols is the same. > > If I use a normal plot command, the symbols are also not filled: > plot(c(1,2,3),c(1,2,3),pch=c(22,23,24),cex=1.5) > > That problem must have occured during a recent lattice update since the color > was not there when I was plotting a year ago with R2.5.x and some older > lattice. It occurs on my linux as well as on my windows machine both with R > 2.6.1 and latest lattice from CRAN. > > So here my questions: How do I get rid of the color? (or is it a bug?) If it > is a feature, so how do I determine the color in both the symbols in the > legend and in the plot itself? (Actually I was overlaying two plots e.g. one > colored diamond and one empty diamond to achieve that effect but if there is > a more efficient way to draw bordered symbols with customized color that > would be preferable...) > > Stefan >
Hi, Stefan You need to use "fill = 'transparent'" in your par.settings call. If you're not using a fill color, you probably should use pch = c(0, 5) instead. This is explained under pch on the ?points help page. Here's a modified version of your example: library(lattice) test <- data.frame(x = c(2, 3, 1, 5), u = rep(1:2, each = 2), g = paste("t", rep(1:2, 2), sep = "")) xyplot(x ~ u, data = test, groups = g, par.settings = list( superpose.symbol = list( pch = c(22, 23), cex = c(1.7, 1.6), fill = c("red", "blue"), col = "black")), auto.key = list(space = "bottom")) HTH, --sundar ______________________________________________ R-help@r-project.org 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.