421 points · by tagawa · 4y ago · 121 comments
Indeed for her kind of data the rainbow palette works okay. But if you have to visualize more complex / denser data, beware of the pitfalls of the rainbow color palette. It is not always the best choice.
IBM did research back in the 90s on perceptually-based colormaps and how to best represent various types of data within the color dimensions of luminescence, saturation and hue [1]. For example, they found that,
(1) Hue was not a good dimension for encoding magnitude information, i.e. rainbow color maps are bad.
(2) The mechanisms in human vision responsible for high spatial frequency information processing are luminance channels. If the data to be represented have high spatial frequency, use a color map which has a strong luminance variation across the data range.
(3) For interval and ratio data, both luminance- and saturation-varying color maps should produce the effect of having equal steps in data value correspond to equal perceptual steps, but the first will be most effective for high spatial frequency data variations and the second will be most effective for low spatial frequency variations.
===
[1] the original link got removed from IBMs website. Back in the day it was under
https://www.research.ibm.com/people/l/lloydt/color/color.HTM
A pdf copy is here:
https://github.com/frankMilde/interesting-reads/blob/master/...
I'd be super interested to see a study that examines how color blindness-aware design affects people without color blindness. Such design often completely avoids red hues, which are of huge importance as visual cues to normally sighted people. It's hard to imagine this doesn't have a negative impact somehow, yet I've never seen this discussed anywhere.
Remember that we are talking about data visualization, not color palettes in general. Red is not particularly important in data viz.
Consider that many non-color-blind Dota players use the colorblind settings because they like the colors better.
Of course restricting available colors affects the diversity of palettes, but often designs can accommodate both handily.
It's nearly 2023 and many, many charts are interactive. There's little excuse to at least having a color blind mode be opt-in for such things. If we're all looking at charts on our personal devices, then local accomodations render your entire argument moot.
You can have your cake and eat it too.
There is already a trap in this palette, the first color looks awfully like the last. It's fine if you just want a palette for a bunch of lines but using it for heatmap could be a bit misleading in edge cases
Your inference doesnt follow from the first point. Hue is bad for magnitude because you dont see a different hue as 'more' or 'less' just 'different'. Hue is great for representing difference without defining one as a focus or preference over the other.
I should hope the 12-bit rainbow palette would be adopted for those kinds of visualizations.
It’s just that you can do it with a hue and a non zero saturation if it suits the style you are looking for.
Plus sometimes you have more than on me set of data mixed and it’s useful to be able to distinguish both by using multiple colours.
> Best Score for your Gender -69420
> Worst Score for your Gender 1000000000
Someone doesn't sanitize their inputs?
> Best Score for your Gender -2147483648
> Worst Score for your Gender 2147483647
I mean, I can see _some_ difference but they are very very close, and I am not sure I could distinguish them in, say, a line plot.
It doesn’t even let me dismiss that message. Who does this? Intentionally breaking your whole site because it might not look good. (This is an iPhone 14 max, so already a pretty big screen, and I’m in portrait orientation.)
The screen I code/write/read on mainly is setup differently to be easier on the eye for long periods but is not as true in colour output, I think (I'm away from it right now so can't check) they may look nearer identical on there.
I suspect people reporting difficulty seeing the difference will be a mix of differences in their eyes and differences in they screen configuration (or screen quality: some things can't be configured around).
I know for sure I cannot complete a full ishihara plate test though so this one is on me.
He has created many colour palettes for specific buildings and applications. See: https://www.pstruycken.nl/EnDyn.html?Li,tag=q&w
The only hint given in the article is
> so each colour requires only four characters when specified as a hexadecimal colour code in a CSS or SVG file
but surely this can't be the answer? Such a minor technical detail doesn't seem worth deviating even slightly from the "ideal" HCL values.
There are several advantages to such minimalism: easier to read and write in code, fewer bytes to store and transfer, and perhaps also satisfying one's ocd.
Let me flip this on you: why use 6 characters to specify colours when 3 will do fine? What exactly would your "ideal" HCL values be?
The post specifically mentions that "slight changes" to the constructed HCL values "must be made" in order to conform to the 12-bit color depth. So the author first derived certain values from theoretical/aesthetic considerations, then modified them for the sole purpose of fitting into 12 bits. This doesn't make sense to me except in very, very niche cases where saving 3 bytes (or even less, considering compression) actually matters more than visual quality.
But also it appears you missed that these changes aren't noticeable:
> Using a 12-bit colour depth limits the available colours, so slight changes to hue, chroma, and luminance must be made, but these are small enough not to be noticeable.
Again, I don't think it's about saving the disk/network the 3 characters. It's about minimalism and perhaps about developer experience: these colours are easier to read, write, and remember. Is that worth nothing?
Perhaps you use a CSS preprocessor and can define variables for your colours and don't need to write them down repeatedly. But perhaps other people don't. Or perhaps they're porting a colour scheme to many different applications. In these cases, three letter colour codes are superior to six letter ones.
ln(12)
------
ln(2)
Color depth (or bit depth) is the number of bits used to indicate the color of a single pixel. So 24-bit color depth produces 16,777,216 colors, 12-bit color depth produces 4096 colors, 8-bit color depth produces 256 colors, and 4-bit color depth produces 16 colors. A 12 color palette is 3.58496250…-bit color depth.>> The palette uses a 12-bit colour depth
It is the author that has misunderstood.[1]
> The palette uses a 12-bit colour depth, so each colour requires only four characters when specified as a hexadecimal colour code in a css or svg file:
Four hexadecimal characters is twelve bits. The colours they’ve chosen can be represented precisely in a 12-bit colour space. Get what they mean?
It’s further confirmed again in the article:
> Using a 12-bit colour depth limits the available colours, so slight changes to hue, chroma, and luminance must be made, but these are small enough not to be noticeable.
How could it ‘limit the available colours’ unless this was their meaning?
I've always had trouble understanding the colour spaces other than RGB. After reading that article, I understood a little more about the luminance due to the greyscale used. From there I searched for "rgb vs cmyk vs hsv" and found this: https://www.geeksforgeeks.org/difference-between-rgb-cmyk-hs... (with annoying "sign up with google" popovers)
From there I wondered if there was a visualizer for the HSV cone, and yes there is! https://color.lukas-stratmann.com/color-systems/hsv.html
So, if you're out there wondering if you should write that visualizer that you had a weird idea for, please, please do so. It may help some random internet person understand something :)
For whatever reason my brain considers it important enough I still remember $dff180 is the first color palette entry address. :-)
Amiga owners will also remember $bfe001, $dff01c, $dff09a... but mainly $4 :P
actually this probably already exists. 8 colors of equal perceived brightness and the same 8 colors at a higher but equal to each other perceived brightness.
Doesn't work because as you adjust the brightness, yellow turns brown before blue stops looking washed-out (or vice versa).
The problem is that yellow is, 1/255 increment for 1/255 increment, about 9 times brighter than blue, and the range of brightnesses that produce useful saturation just doesn't isn't wide enough to accomodate that difference.
The colors you get are a function of the brightness (also hue and saturation) you use. If you pick a fixed brightness and require yellow and blue to both be that bright, either the yellow is brown of the blue is washed out (or both) depending on which brightness you picked. As you adjust the brightness you're trying to design the palette for, it switches from one problem to the other.
Here is one I use ( in Terminator)
palette = "#000000:#cc0000:#408600:#c4a000:#204a87:#75507b:#06839a:#d3d7cf:#555555:#ef2929:#8ae234:#fce94f:#729fcf:#ad7fa8:#34bae2:#eeeeec"This was at the bottom, but even earlier in the blog when the codes were first shown, base0 and base00 just seemed kludgy to me on first sight. Then to see this note shows that I wasn't the only person to have issues with the naming. I know naming is hard and all, but this just seemed like low effort
These look fantastic as demoed here: https://grid.iamkate.com
That one is a 4-bit palette.
I have to admit I was expecting 4096 colors too, the "rainbow" of Amiga's HAM6 graphics mode: https://commons.m.wikimedia.org/wiki/File:Amiga_500-3000_HAM...
Shows realtime and historic energy generation data for the uk.
Recently been updated to include price history and other stuff.
Bit when I create visualisations the info I need (can't guess myself or workout) is what it looks like with colour blindness. That's rather more common than not having access to colour.
> The resulting palette has evenly-spaced hues, only small variations in chroma, and smoothly increasing and decreasing luminance:
IMO the palette does not have decreasing luminance. To my eye, on a color corrected monitor, luminance seems to peak at yellow.
I'll brave the syntax and try to paste my current method:
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
I wish I knew more about what this code is really up to, I inherited it from somewhere, can't remember, and I'll admit I haven't tried to understand it yet.These look the same to approx 6% of the population, especially when not immediately next to each other or used for thin lines/bars. Accessibility is seemingly never considered
By which I mean, is there any objective measure of human perceived luminance?
"Magnitude estimation a technique standardly applied in psychophysics to measure judgments of sensory stimuli (Stevens 1975). The magnitude estimation procedure requires subjects to estimate the magnitude of physical stimuli by assigning numerical values proportional to the stimulus magnitude they perceive. Highly reliable judgments can be achieved for a whole range of sensory modalities, such as brightness, loudness, or tactile stimulation."