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]]

