If I color the world's 41 time zones using the qgis' "spectral" gradient, I get the following, as expected:
I like the colors (though it'd be nice to get a little purple in there), but want to re-arrange them so that nearby values have very different values. In other words, I want to do the opposite of a gradient, and have colors change as much as possible between the 41 discrete values. Notes:
I realize something like this requires discrete values, since creating an continuous "antigradient" wouldn't work.
I'm asking for a general procedure to do this for any gradient, not just this specific gradient. In particular, I plan to create a pure "rainbow" gradient where every color has saturation 1 and value 1.
I'm looking for an "antigradient" that has 41 different colors. I realize I could use the 4-color theorem, and the data I'm using even has color_6 and color_8 fields suggesting which zones should have different colors. However, I want to create a legend which maps each color to a value.
I realize the term "have colors change as much as possible" isn't well-defined, but hopefully I've gotten the idea across. As a counterexample, using alternating colors wouldn't work because each value would then have the same color as the values that are 2 above and 2 below it. What I want: the closer two values are, the more different the colors are.
Using "random colors" works surprisingly well, but it's hit and miss, since I can't guarantee nearby values will have different colors:
I'd personally refer to these as "divergent" gradients, but that term apparently already has a different meaning.
The cpt-city christmas-candy gradient is one of the few that seems to do what I want, provided you use it with only 3 discrete values. The runners up are the Set1, Set2, and Set3 gradients, which make a deliberate effort to put different colors next to each other, but, again, they won't work for 41 values.
Other cpt-city gradients (such as Spectral_11) ARE discrete, but still map nearby values to nearby colors.
I'm familiar with the Kelly colors, but they're not quite what I'm looking for.
I asked a mathematical version of this question at: https://mathematica.stackexchange.com/questions/198888/find-permutation-with-highest-organization-number-oeis-a047838 but I now believe that asks the wrong question
This isn't strictly relevant, but when I save images like the above using qgis, they should be paletted with a small number of colors, but actually end up 24-bit with thousands of colors.