[R] Maximum discrepancy palette

Michael Sumner 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.

Cheers, Mike.

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,
> 6L))
> image(x)
> # 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 ?
>
> Thanks,
> Etienne
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-help mailing list