[R] specify breaks in divergent palette in RColorBrewer: was divergent colors around zero in levelplot()
dmck at u.washington.edu
Tue Nov 26 18:48:13 CET 2013
Thanks to everyone who weighed in on this. I found a naive solution that was good enough for my needs, and it may take me a bit to get the subtleties
of your comments.
On Nov 26, 2013, at 2:12 AM, Barry Rowlingson <b.rowlingson at lancaster.ac.uk> wrote:
> On Tue, Nov 26, 2013 at 9:58 AM, Prof Brian Ripley
> <ripley at stats.ox.ac.uk> wrote:
>>> But the image function (and probably levelplot) doesn't allow that so
>> Mis-information alert! The help says
>> col: a list of colors such as that generated by ‘rainbow’,
>> ‘heat.colors’, ‘topo.colors’, ‘terrain.colors’ or similar
>> and look at what they generate. Or see e.g. ?col2rgb .
>> Although base graphics has the concept of a palette of colours, AFAIK it
>> has always been bolted on top of a general colour specification,
>> originally RGB and for many years already RGBA.
> Yes image allows you to specify col=, but it always specifies a
> palette. The matrix values are scaled from 1:length(col) and looked up
> in that palette. You can't call image with z as matrix of colours and
> get those colours, nor set col to a matrix of colours and a see those
> colours laid out. This is unlike points() where specifying col= as a
> vector of the same length as the number of points gives you a 1:1
> mapping of points to colours.
> To do image() with a 1:1 mapping of cell values to colours requires a
> tiny bit of hoop-jumping.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Pacific Wildland Fire Science Lab
US Forest Service
School of Environmental and Forest Sciences
University of Washington
dmck at uw.edu
More information about the R-help