Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's a really interesting video; I asked about this on math.stackexchange, and it already has one response about why φ is optimal for your color spacing.

http://math.stackexchange.com/q/93623/37



Hey, that’s wonderful! I’ve linked back in the video description. Is there a place to ping you when I get the blog post up?

Thumbnail sketch: people often want to generate sequences of distinct colors for data visualization, for example for successive map layers. You can make a sequence of n trivially: pick n evenly spaced points on the color wheel. But things get trickier when you add two practical requirements: handle infinite n, and produce colors such that any contiguous dozen or two are always reasonably distinguishable. You can do a fair job by interleaving or using randomness, but when I tried I ended up with code that was (1) more complex and carrying more state than I thought was reasonable for something so simple-seeming or (2) a bunch of unreadable bitwise operations and such. Plus, there’s clear approach to optimality.

The golden angle comes to the rescue by being “the most irrational number”. As you immediately spotted, any irrational number will have no repeats. But clearly, one quite near a ratio of small integers will soon have many apparent repeats: for example, 1:1.50000004917813... might be technically fine, but perceptually it’s the same small set of colors for a long time. So what’s special about φ for our purposes is that, speaking informally, it’s as far as you can get from ℚ.

Therefore, given any angle on the color wheel, we can simply add the golden angle and be assured of (1) a quite different color and (2) more quite different colors as we recurse, until we’re packing the color wheel so densely that we’re simply fighting the eye’s inability to distinguish similar colors.

I think this might be useful to dataviz people, who often seem to resort to fairly Byzantine methods. I’ve noticed several Stack Overflow threads on color sequences that gave only more complex and less useful ones.[0]

And I think this counts as a place where using φ in the real world has a clear justification. So we’re up to one….

0. For example:

· http://stackoverflow.com/questions/309149/generate-distinctl...

· http://stackoverflow.com/questions/773226/generate-unique-co...

· http://stackoverflow.com/questions/470690/how-to-automatical...

· http://programmers.stackexchange.com/questions/44929/color-s...

However, some of these people want values distributed in perceptual 3-space, which is more than this golden angle method can do by itself.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: