Color Palettes for Data Visualization

Sequential, diverging or categorical: how the shape of your data picks the palette, and why luminance does most of the work.

Short answer: there are three palette families and the data chooses between them, not taste. Ordered data with one direction takes a sequential palette that climbs steadily in lightness. Ordered data with a meaningful middle takes a diverging palette, two sequential ramps meeting at a neutral point. Unordered groups take a categorical palette, where the colors must look different from each other but must not look ranked. Nearly every bad chart is one of these three used for the wrong data, and the rainbow is the classic case of the third pretending to be the first.

The three families, and the question each answers

FamilyData it fitsWhat carries the messageTypical failure
SequentialOrdered, one direction from low to highMonotonic lightnessLightness that flattens in the middle, so a whole range of values look alike
DivergingOrdered around a meaningful centre: zero, a mean, a targetTwo lightness ramps and a hue flip at the centreA centre placed where the data has no centre, inventing a story
CategoricalUnordered groupsHue differences at roughly equal lightnessToo many categories, or one color much darker so it reads as more important

Getting the family right is most of the work. The classic reference implementation of this idea, ColorBrewer, was built around exactly three inputs: how many classes you have, which of the three families your data needs, and where the map will be seen, because a palette that survives on a screen may not survive a photocopier.

Why lightness is the load bearing channel

People read order out of lightness. Colin Ware showed in 1988 that a grey ramp is excellent at conveying the shape of a surface, because it changes monotonically in luminance, while a sequence that cycles hue is better at letting you read off a specific value but worse at revealing form. The practical conclusion has held up for decades: if your data has an order, your palette needs a lightness ramp, and hue is a passenger.

This is the same argument that runs through value, saturation and composition and it is why a palette built by rotating hue at fixed HSL lightness fails. HSL lightness is not perceptual lightness, a point set out in detail on the OKLCH page. Two colors it calls equally light can differ by tens of points of actual perceived lightness, so a supposedly even ramp arrives with cliffs and plateaus in it.

The rainbow, fairly stated

The rainbow colormap has been criticised in the visualization literature for a long time, and the criticism is specific rather than aesthetic. It is not perceptually ordered, so viewers cannot say which of two colors is higher without consulting the legend. Its luminance rises and falls, which creates bright bands at yellow and cyan that look like features in the data and are not. And it hides real detail in the long green stretch, where large data differences produce small color differences.

A 2020 review in Nature Communications put numbers on the cost across published science, showing how uneven color maps distort what readers take away and how many of the common ones are unreadable for people with color vision deficiencies.

The honest counterweight, published in 2023 by three of the field's own color researchers, is that rainbows are not uniformly bad. Their many distinguishable hues make it easier to name and communicate a specific value, and for some tasks that matters more than perceptual ordering. The defensible position is not that the rainbow is forbidden; it is that it should be a deliberate choice for a task that needs value identification, never the default for a task that needs magnitude.

How many categories can you actually use

Fewer than you want. A categorical palette works by hue difference, and hue names run out quickly.

CategoriesRealistic outcomeWhat to do instead
Up to 5Comfortable; colors stay distinct and nameableNothing, this is the good case
6 to 8Workable with care; needs checking at real mark sizeDirect labelling for the important series
9 to 12Legend lookup becomes slow and error proneGroup the tail into "other", or use small multiples
More than 12Color has stopped encoding anything reliableChange the encoding: position, faceting, interaction

Mark size matters more than most guidance admits. A 2018 study built quantitative models showing that the color differences needed for reliable discrimination grow as marks get smaller and thinner. Palettes chosen by looking at large legend swatches routinely fail on a scatterplot of three pixel dots, and nothing about the palette changed except the size of the thing it was painting.

Designing for color vision deficiency, without ceremony

Red and green as the two ends of a scale is the single most common accessibility failure in charts, and it is easy to avoid. Blue to orange carries the same "opposite directions" meaning and survives the common deficiencies. Work published in 2018 showed that colormaps can be optimised for both perceptual uniformity and color vision deficiency at the same time, so this is not a trade-off you are forced to accept.

Three habits cover most of it. Vary lightness as well as hue, so the ordering survives when hue does not. Never let color be the only cue for something important; add a shape, a pattern, a direct label. And check that meaningful graphical elements meet the accessibility contrast floor against their background, which is a separate requirement from the palette itself and is covered in the contrast ratio explained. The classroom side of the same question is in inclusive color teaching.

A working checklist

Name the data type first. Ordered, ordered around a centre, or unordered. If you cannot say which, the chart has a bigger problem than its colors.

Check the lightness ramp in greyscale. Desaturate the palette. A sequential scheme should still read as a ramp. A categorical scheme should not read as a ranking.

Put the centre where the data's centre is. A diverging palette anchored at an arbitrary value manufactures a division that does not exist.

Test at the real mark size, on the real background. Not in the legend.

Keep one palette per meaning. If blue means "region A" in one chart it should not mean "high" in the next one.

The connection to the games

Huesort is a sequential palette problem with the answer removed. You are handed shades out of order and asked to arrange them into an even gradient, which is exactly the judgement a sequential scheme is asking your reader to make at a glance. Playing it a few times makes the abstract complaint about non-monotonic lightness concrete: the places where you hesitate are the places a colormap would hide data.

Huetween is the interpolation half of the same question. Where a palette's midpoint falls determines which values look like the middle of your range, and your eye's answer is not the arithmetic mean of two hex codes. If you want the design side rather than the perception side, choosing color palettes covers the composition rules.

Can you build an even ramp by eye? Huesort gives you shuffled shades and asks for a smooth gradient. It is the sequential-palette judgement, isolated and scored.

Play Huesort →

Frequently asked questions

How do I choose between sequential, diverging and categorical?

Ask what shape the data has. One direction from low to high takes sequential. An ordered range with a meaningful middle, such as zero or a target, takes diverging. Groups with no order take categorical. If you cannot name the shape, the chart has a problem colour cannot fix.

Is the rainbow colormap always wrong?

No, and the strongest recent statement of that came from colour researchers in the visualization community itself. Its many nameable hues help when the reader's task is to identify a specific value. It is a poor default for magnitude, because it is not perceptually ordered and its uneven luminance creates bands that look like data.

Why does everyone say to use viridis-style maps?

Because that family was designed to climb steadily in perceptual lightness and to stay distinguishable under the common colour vision deficiencies. Those two properties are what make an ordered map readable, and they are properties you can check rather than opinions you have to accept.

How many colours can a categorical palette have?

About five without effort, up to eight with care and checking, and beyond roughly a dozen colour has stopped encoding anything reliable. Past that point, direct labelling, grouping the small categories together, or small multiples will beat adding another hue.

Does the size of the marks change which palette works?

Yes, more than most guidance admits. Published models show that the colour difference needed for reliable discrimination grows as marks get smaller and thinner. A palette that is comfortable in a legend can fail on small scatter points, with nothing changed but the size.

What is a safe alternative to a red-to-green scale?

Blue to orange. It carries the same sense of two opposite directions, it keeps a usable lightness difference at both ends, and it survives red-green colour vision deficiencies, which are the common ones. Add a lightness ramp so the ordering does not depend on hue alone.

Does a good palette make my chart accessible?

It helps and it does not finish the job. Accessibility guidelines require that colour is not the only way information is conveyed, and that meaningful graphical elements meet a contrast floor against their background. Those are separate checks from the palette, and both are measurable.

Should I check my palette in greyscale?

It is the fastest single test there is. Desaturate it: a sequential scheme should still read as a smooth ramp, and a categorical scheme should not read as a ranking. Anything that fails in greyscale is relying on hue alone, which is exactly the fragile case.

Keep reading

Sources: Harrower, M. and Brewer, C. A. (2003), ColorBrewer.org: an online tool for selecting colour schemes for maps, The Cartographic Journal 40(1), 27; Ware, C. (1988), Color sequences for univariate maps: theory, experiments and principles, IEEE Computer Graphics and Applications 8(5), 41; Borland, D. and Taylor, R. M. (2007), Rainbow color map (still) considered harmful, IEEE Computer Graphics and Applications 27(2), 14; Ware, C., Stone, M. and Szafir, D. A. (2023), Rainbow colormaps are not all bad, IEEE Computer Graphics and Applications 43(3), 88; Crameri, F., Shephard, G. E. and Heron, P. J. (2020), The misuse of colour in science communication, Nature Communications 11, 5444; Szafir, D. A. (2018), Modeling color difference for visualization design, IEEE Transactions on Visualization and Computer Graphics 24(1), 392; Nuñez, J. R., Anderton, C. R. and Renslow, R. S. (2018), Optimizing colormaps with consideration for color vision deficiency to enable accurate interpretation of scientific data, PLOS ONE 13(7), e0199239; W3C, Understanding Success Criterion 1.4.11, Non-text Contrast.

Understand it, now train it. The daily games stay free forever. A Personal Pass adds progress tracking (trends + export); Teacher / School tools let you assign it and follow a whole class. For teachers & self-learners →

Updated · By Lajos Toldi — educator and researcher in adaptive intelligent tutoring systems at AI24EduLabs (part of AI24Labs). Scientific claims are checked against authoritative sources; see our editorial policy.
Privacy · Cookies · Terms · About · Contact