[R] aligning axis labels in a colorkey from levelplot
Deepayan Sarkar
deepayan.sarkar at gmail.com
Fri Jun 22 11:00:04 CEST 2012
On Tue, Jun 19, 2012 at 10:55 PM, Stephen Eglen
<S.J.Eglen at damtp.cam.ac.uk> wrote:
>>
>> Justification is hard-coded, and that's not easy to change. This is
>> not only for the colorkey; e.g.,
>>
>> xyplot(y~1, scales = list(alternating = 3))
>>
>> will also give you left-aligned axes on the right.
>>
>> My only suggestion (other than custom labels as suggested by ilai) is
>>
>> levelplot(matrix(4:12,3,3), colorkey = list(space = "left"))
>
> Thanks Deepayan; I tried the custom labels approach, but unfortunately I
> don't think that works as-is; the labels are of different widths as the
> font is not fixed-width.
You can specify a fixed-width fontfamily if that helps:
levelplot(matrix(seq(4,120,l=9),3,3),
colorkey = list(at = seq(0, 120, 20),
labels = list(labels = c(' 0',' 20',' 40','
60',' 80','100','120'),
fontfamily = "courier",
font = 1)))
-Deepayan
More information about the R-help
mailing list