[R] aligning axis labels in a colorkey from levelplot

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Sat Jun 16 10:11:56 CEST 2012


R does a great job with the fine details regarding plots.  e.g in the
following:

library(lattice)
y <- -4:4/10
xyplot(y~1, las=1)

the y axis is labelled with numbers -0.4, -0.2, 0.0, 0.2, 0.4 with the 
numbers aligned on the decimal point.

How do I get the same behaviour in the colorkey of a levelplot?  e.g.

levelplot(matrix(y,3,3))

the numbers in the colorkey seem left-aligned, and because of the minus
sign, the numbers now do not align on the decimal point.  Likewise when
the number of digits changes:

levelplot(matrix(4:12,3,3))

Thanks, Stephen



More information about the R-help mailing list