[R] Adding units to levelplot's colorkey
David Winsemius
dwinsemius at comcast.net
Tue Nov 15 13:54:20 CET 2011
On Nov 14, 2011, at 7:20 PM, Carlisle Thacker wrote:
> Thanks, Dennis. Yes, I can do that, but that locks the physical
> units to locations of the labels. I had hoped that there might be
> something a bit more flexible, like a subtitle or more general text.
If you would take the time to describe what you wanted you would save
everybody's time, yours and ours. I'm sure that levelplot's help page
refers you to the xyplot help page for details on key parameters. So
here are a few of the parameter it makes available but the entirelist
takes up several pages and is not reproduced here:
title
String or expression giving a title for the key.
cex.title
Zoom factor for the title.
lines.title
The amount of vertical space to be occupied by the title in lines (in
multiples of itself). Defaults to 2.
--
David.
> Carlisle
>
> On 11/14/11 6:03 PM, Dennis Murphy wrote:
>> You don't show code or a reproducible example, so I guess you want a
>> general answer. Use the draw.colorkey() function inside the
>> levelplot() call. It takes an argument key =, which accepts a list of
>> arguments, including space, col, at, labels, tick.number, width and
>> height (see p. 155 of the Lattice book). More specifically, the
>> labels
>> argument also accepts a list of values, with components at, labels,
>> cex, col, font, fontface and fontfamily. You could attach the units
>> as
>> labels with a combination of at = and labels = inside the (outer)
>> labels argument, something like
>>
>> myAt<- c(1, 3, 5, 7, 9)
>> myLab<- paste(myAt, 'cm')
>>
>> levelplot( ...
>> draw.colorkey(key = list(labels = list(at = myAt, labels =
>> myLab)),
>> ... )
>>
>> If that doesn't work, then please provide a reproducible example.
>>
>> HTH,
>> Dennis
>>
>> On Mon, Nov 14, 2011 at 12:34 PM, Carlisle Thacker
>> <Carlisle.Thacker at noaa.gov> wrote:
>>> How to add units (e.g. "cm") to the color key of a lattice
>>> levelplot?
>>>
>>> The plots looks fantastic, but it would be nice to indicate
>>> somewhere near
>>> the end of the color key that the values associated with its
>>> colors are in
>>> centimeters or some other physical units.
>>>
>>> The only thing I find is the possibility to specify the labels so
>>> that one
>>> explicitly includes the units. That leaves little flexibility for
>>> positioning where this information appears. Is there a better way?
>>>
>>> ______________________________________________
>>> R-help at 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.
>>>
>
> ______________________________________________
> R-help at 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list