Color Scales and Aesthetics
How to pick a color palette that conveys meaning and respects your audience
We have talked about color in passing — now we focus on it deliberately. Color is the most over-used and abused encoding in data visualization. A well-chosen palette is invisible: the reader just reads the chart. A poorly-chosen one fights the data and sometimes lies about it.
The three families of color scales
There are essentially three families. Knowing which family fits which kind of data is 80% of the battle.
Qualitative (categorical) palettes
For distinct, unordered categories (continents, products, teams). The palette uses different hues and the reader sees "these belong together, those belong over there."
Good qualitative palettes: "Plotly", "D3", "G10",
"Vivid", "Set2", "Pastel".
Rule of thumb: keep qualitative palettes to ≤7 colors. Past that, the eye starts confusing similar hues.
Sequential palettes
For ordered, one-sided data — low to high, with no special midpoint. Sequential palettes vary in luminance of a single hue (or smoothly through related hues).
Good sequential palettes: "Viridis", "Plasma", "Magma",
"Cividis", "Blues", "YlOrRd", "YlGnBu".
Diverging palettes
For two-sided data with a meaningful midpoint — correlations around 0, year-over-year change, deviations from a baseline. Diverging palettes use two hues for the extremes and white (or neutral) for the midpoint.
Good diverging palettes: "RdBu", "RdBu_r" (reversed),
"PiYG", "BrBG", "Spectral" (use carefully — borderline).
The centerpiece move: color_continuous_midpoint=0. Without it,
the white anchor floats arbitrarily; with it, "no change" is the
neutral pivot, and the reader instantly sees positive vs negative.
The Jet / rainbow trap, revisited
We mentioned this already, but it's important enough to repeat:
avoid Jet, rainbow, and any palette that is not perceptually
uniform. They create false visual structure that looks like
data features but isn't. Viridis is the modern default for a
reason — it's specifically designed to be smooth and uniform.
Accessibility: colorblind-safe palettes
Roughly 8% of men and 0.5% of women have some form of color vision deficiency, most commonly red-green confusion. Several Plotly palettes are colorblind-safe by design:
"Viridis","Cividis","Plasma","Magma"(sequential)"BrBG","PuOr","PRGn"(diverging)"Safe","Plotly"(qualitative — both reasonably safe)
If your chart uses red-vs-green to convey "bad vs good," fix it. Either use a colorblind-safe palette or double-encode with shape or labels.
Don't use color for emphasis if you don't have to
A common beginner habit: every chart series gets a different color, even when only one matters. The result is a noisy "Christmas tree" chart.
Better: gray out everything except the focus.
The reader's eye goes directly to Germany. The other 29 countries provide context without competing for attention.
A few quick rules
- Qualitative palettes for nominal categories (≤7 colors).
- Sequential palettes for ordered/quantitative with one-sided range.
- Diverging palettes for data with a meaningful midpoint
(always set
color_continuous_midpoint). - Avoid rainbow / Jet for any quantitative data.
- Test in grayscale — if the chart still works in B&W, you've used color carefully.
- Highlight, don't decorate — if only one series matters, color only that one.
Check your understanding
Which color palette family should you use for unordered categorical data with 5-7 categories?
A sequential palette like Viridis.
A diverging palette like RdBu.
A qualitative palette like Plotly or Vivid — distinct hues with no implied ordering.
A grayscale ramp.
Why should a diverging color palette like RdBu be centered at the meaningful midpoint (e.g., 0 for correlations or year-over-year change)?
Plotly requires it.
It makes the chart smaller.
Centering the white anchor at the meaningful zero makes the reader instantly see positive vs negative, and the chart's coloring directly mirrors the data's sign.
White is more accessible than other colors.
A reasonable design move for a chart with 30 lines where you want to spotlight just one is:
Use a different color for all 30 lines.
Add a 3-D effect.
Color the one important line in a bright hue and color the other 29 light gray.
Drop 29 lines and only show the important one.
Approximately what fraction of men have some form of color vision deficiency?
About 0.1%.
About 1%.
About 8%.
About 50%.