The main message of the lesson is something crucial:
Great visualizations donβt use color just for decoration: they use it with intent.
There are only three valid reasons to use color. Let's review them!
β
1οΈβ£ Colors to represent values
Use color to encode data in a perceptually linear way. β The goal: emphasize one end of a range (sequential palette) or both ends (diverging palette). β That's the case for a heatmap for instance! Without colors, no more meaning. So color is crucial here.
One of the most famous heatmap example. Shows the vaccine effect on Measles. D3 code.
β
2οΈβ£ Colors to distinguish groups
Use color to separate categories that have no intrinsic order. β Each color should have similar visual weight so that all groups are shown equally (qualitative palette).
That's the one everyone forgets doing! β Use color to draw attention to what matters most: a specific group, range, or threshold. β Highlight colors work best when the rest of the chart is kept subtle and desaturated.
Roy Debatreyo (a student of my Matplotlib journey project) used a technique I love here: faceting + color highlight on each panel.
β
β οΈ A few exceptions
That's dataviz! There are rare cases where breaking the rule can make sense:
Double encoding: when color repeats information already shown on an axis, to reinforce a message.
Consistency across charts: when several charts show the same groups and you want colors to match.
β
Thatβs it for today!
Next time you add colors to a chart, check if they fit one of these three goals. If not: remove them.
See you next week,
β
Yan β PS: In case you missed it, I built a tool to help you create a beautiful homepage in just a few minutes.
PPS: A few spots are still available for my Dataviz with Pythonworkshop this December! β