Lesson 6 of 20

Colour — sequential, diverging, categorical, and colour blindness

why the rainbow is a bad colour map

Colour — sequential, diverging, categorical, and colour blindness
There are only three families of colour map. One that grows in one direction, one with zero in the middle, and one where colours merely differ. Mixing them up produces a lie.

Colour is the part of a chart that breaks most easily. The rules, though, are simple. There are only three families of colour map.

🌡️
Sequential
a quantity that only grows from zero. Light → dark, one direction.
expression · cell counts · density
⚖️
Diverging
a quantity with a meaningful zero in the middle. Blue ← white → red.
z-scores · log2FC
🎨
Categorical
unordered names. They only need to differ.
cell types · tumour types · conditions

The heatmap in Fig. 6A shows z-scores, so it needs a diverging map. The UMAP in Fig. 5B is coloured by cell type, so it needs a categorical one. Swap the two and the figure starts lying.

Recolour the same heatmap with different maps. Try the colour-blind and greyscale simulations too.
Loading…
viridis is beautiful, but zero is not at its centre. Z-scores need a diverging map.
Python Runs in your browser

Categorical colour has a different problem. There are fewer usable colours than you think.

Number of categoriesWhat to do
2–4colour is enough
5–8pick a colour-blind-safe palette (Okabe-Ito and friends)
9 or morecolour alone will not do. Label directly on the chart, or colour only what matters and grey the rest

The UMAP in Fig. 5B colours more than ten cell types. So they wrote the names straight onto the clouds — a legend alone would not have let anyone match them up. That is the right call.

Normal vision on top, the simulation below. Red and green become nearly the same colour down there.
Python Runs in your browser
🤔 Check yourself
Which colour map suits a heatmap of z-scores (mean 0, sd 1)?
🤔 Check yourself
You need to colour fourteen cell types on a UMAP. What is best?
🤔 Check yourself
What do you lose by using blue/orange instead of red/green?