Lesson 6 of 20
Colour — sequential, diverging, categorical, and colour blindness
why the rainbow is a bad colour map
Colour is the part of a chart that breaks most easily. The rules, though, are simple. There are only three families of colour map.
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.
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 categories | What to do |
|---|---|
| 2–4 | colour is enough |
| 5–8 | pick a colour-blind-safe palette (Okabe-Ito and friends) |
| 9 or more | colour 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)?
Answer A z-score has a meaningful zero — the row mean. With a sequential map that zero lands at an arbitrary position and above/below become indistinguishable.
🤔 Check yourself
You need to colour fourteen cell types on a UMAP. What is best?
Answer Eight or so is the practical limit for distinguishable colours. Beyond that, matching legend to cloud becomes the reader's chore. That is why Figs. 5B, 7A and 8A all label in place.
🤔 Check yourself
What do you lose by using blue/orange instead of red/green?
Answer Nothing at all — and it even survives greyscale printing, because the lightnesses differ. Red/green is a convention, not a justification.