[R] Maximum discrepancy palette
mdsumner at gmail.com
Tue Dec 13 01:04:44 CET 2011
Try the RColorBrewer package, with function ?brewer.pal
You probably want a Qualitative palette, the details are in that
function's help page.
On Tue, Dec 13, 2011 at 10:14 AM, Etienne B. Racine <etiennebr at gmail.com> wrote:
> I'm looking for a palette that would maximize the discrepancy with
> neighbouring elements.
> I have a raster image of objects tagged with integers. I'd like to
> highlight the different objects by using a palette that would maximize this
> difference with neighbours as close numbers tend to be neighbours. Of,
> course, I don't expect this to be color-blind safe are even beautiful, but,
> I'd like to have a good chance of separating neighbours.
> It looks a bit like :
> x <- structure(c(1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 3,
> 2, 1, 1, 1, NA, NA, 3, 1, 4, 4, 3, 3, 3, 4, 4, 3, 3, 3, 3), .Dim = c(6L,
> # i've tried things like
> image(x, col = sample(rainbow(5)))
> But with number of objects increasing (~80), I tend to have same colours
> (or very close ones) as neighbours.
> Does that palette exist ?
> [[alternative HTML version deleted]]
> 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.
Institute for Marine and Antarctic Studies, University of Tasmania
e-mail: mdsumner at gmail.com
More information about the R-help