[R] lattice: horizontal alignment of labels in key
Thomas Zumbrunn
t.zumbrunn at unibas.ch
Tue Jun 2 21:09:26 CEST 2009
Dear R users
I have problems horizontally aligning labels in keys of lattice plots when the
labels make use of plotmath. Here's a self-contained example:
dat <- data.frame(x = rnorm(10),
y = rnorm(10),
z = factor(rep(c("a", "b"), each = 5)))
xyplot(y ~ x, dat, groups = z,
auto.key = list(columns = 2,
text = c(expression(plain("alright")),
expression(italic("too low")))))
It seems like the grid object which the lattice function creates from the key
arguments has different heights for the two labels since the second label does
not stretch over the baseline.
Any ideas how I could circumvent the problem (other than manipulating the key
grob)?
Best wishes
Thomas Zumbrunn
More information about the R-help
mailing list