[R] Specifying point symbol fill colour in lattice xyplot keys
Wayne Rochester
wayne.rochester at csiro.au
Tue Mar 12 02:11:05 CET 2013
Dear all,
When defining explicit keys with xyplot, I have previously used the fill
parameter to set the background colour of point symbols. That's no
longer working for me, and I am wondering whether it's a bug or whether
I've misinterpreted the documentation and have been relying on a feature
wasn't intended. If the latter, can anyone suggest the correct way to do it?
Here's an example of what I am trying to do:
library(lattice)
print(xyplot(y ~ x,
data=data.frame(x=1:10, y=1:10),
key=list(points=list(pch=21,
col="blue",
cex=3,
fill="red"))))
Only the key is of interest here. It doesn't match the data and isn't
meant to.
On R 2.15.2 and lattice 0.20-10 the circle in the key has a blue outline
and a red fill colour. On R 2.15.3 and lattice 0.20-13 the fill is
transparent (or white).
The source code for draw.key looks like it is sill trying to support the
fill option. I have been able to confirm the old behaviour with the old
R and lattice versions on Ubuntu 11.10 and openSUSE 12.2. I have
confirmed the new behaviour with the new versions on Ubuntu 11.10 and
Windows 7.
Many thanks,
Wayne Rochester
CSIRO, Brisbane, Australia
More information about the R-help
mailing list