Skip to content
ColorArchive
Data Visualization
2028-07-08

Color in Data Visualization: Encoding, Perception, and the Rules That Are Actually Followed

Data visualization color is a specialized discipline within color design, governed by how humans perceive differences in hue, saturation, and value when those differences carry quantitative meaning. The rules are different from brand color, UI color, or print color — and violating them silently degrades the accuracy of the data communication, sometimes in ways that are worse than using no color at all.

Highlights
There are three types of data that require three different color encoding strategies. Categorical data (country, product type, category) requires colors that are maximally distinct — hue-based differentiation where each category gets a different hue, all at similar lightness so no category appears more important than others. Sequential data (temperature from low to high, revenue from small to large) requires a single-hue or two-hue ramp that changes in lightness from light (low values) to dark (high values) — the perceptual ordering is reliable because humans judge lightness differences more accurately than hue differences. Diverging data (values centered around a neutral point, like deviations from average, profit vs. loss) requires a two-hue ramp with a neutral center, where each hue encodes direction (positive vs. negative) and lightness encodes magnitude. Using a sequential palette for categorical data, or a categorical palette for sequential data, is one of the most common and most damaging mistakes in data visualization.
The luminance channel carries the most reliable quantitative information in color-encoded data. Humans perceive differences in lightness (luminance) more accurately and consistently than differences in hue or saturation. This is why sequential palettes work: the ordering of light-to-dark reliably conveys low-to-high. The failure mode of many data visualization tools is defaulting to hue-based sequential palettes (e.g., yellow to red to blue) where the hue changes without a consistent lightness progression — the result is a scale where the perceptual ordering depends on the viewer's hue perception, which varies significantly and is systematically disrupted by color vision deficiency. Rule of thumb: any sequential palette you use should pass as a correct ordering when converted to grayscale. If it does not, the lightness encoding is broken.
Colorblind-safe data visualization palettes are not a nice-to-have — data visualizations are often used by multiple stakeholders in organizational contexts, and a palette that fails for colorblind viewers is inaccessible to approximately 1 in 12 male viewers. The established safe palettes: the Okabe-Ito palette for categorical data (8 distinct colors that work for deuteranopia, protanopia, and tritanopia); viridis, inferno, and cividis for sequential data (all designed to be perceptually uniform and colorblind safe). For diverging data: use purple-green or orange-purple rather than red-green. Test every visualization using a colorblind simulation tool before publishing. Many charting libraries include built-in colorblind-safe palettes — prefer these over custom color choices when the chart is in a context where colorblind-safe data communication is required.

Building a categorical palette for charts

A categorical palette for data visualization needs 6-8 maximally distinct colors at similar lightness values (within a 10-point lightness range). The process: (1) Select hues spaced approximately 45 degrees apart around the color wheel — this provides a foundation of hue diversity. (2) Adjust each hue to similar lightness (target HSL lightness 50-60% for colors that work on white backgrounds). (3) Run colorblind simulations on the full set — identify any pairs that become indistinguishable, and replace one of them. (4) Check that each color achieves at least 3:1 contrast on white — required for chart elements. (5) Define a dark-mode variant (typically by increasing lightness to 65-75% on dark backgrounds). The challenge with equal-lightness categorical palettes: some hues appear lighter than others even at the same HSL lightness value, because HSL lightness is not perceptually uniform. OKLCH provides perceptually uniform lightness, making it easier to achieve truly equal-appearing colors across hues.

Using color to highlight rather than encode

Not every chart requires color encoding. In many contexts, color is most effective not as a data dimension but as a highlighting mechanism — drawing attention to the data point the viewer should notice. This is the 'gray + one accent' visualization strategy: render all data series or bars in a medium neutral gray, then color the single element that represents the key insight in a vivid accent color. This technique is particularly effective in presentation contexts (slides, reports) where the viewer needs to extract the takeaway quickly. The accent color carries no categorical meaning — it means 'this is the important one.' The result is typically clearer communication than a full categorical palette, because the viewer's attention is directed before they must parse a legend. Reserve full categorical color palettes for exploratory data tools where the viewer needs to distinguish all series simultaneously.

Newer issue
Color on HDR Displays: Wide Gamut, Tone Mapping, and the New Design Constraints
2028-07-01
Older issue
Color Naming in Design Systems: Semantic, Functional, and Why Your Naming Breaks at Scale
2028-07-15