Practical guide
Diverging Heatmap Colors: Put Zero at the Intended Center
Choose an explicit meaningful center. Compare ordinary, symmetric and piecewise mappings for the same seven changes before calling a palette zero-centered.
On this page
Give the center a meaning before assigning colors
Zero is not automatically the middle of an asymmetric numeric range. For a minimum of -4 and a maximum of 12, ordinary min/max normalization puts zero one quarter of the way along the scale. If the palette’s neutral point is halfway, zero receives a color from the lower side instead of that neutral point.
Decide what the chart should communicate. A diverging palette normally emphasizes a meaningful critical value, such as zero, rather than an arbitrary midpoint. ColorBrewer also describes customized asymmetric schemes; asymmetry is not intrinsically an error. The problem is a mismatch between the intended center, the data-to-color rule and the legend.
Basis: [4]
These original examples compare numeric scale coordinates. They do not assert that equal coordinate steps produce equal perceived color changes, or that positive changes are good and negative changes are bad.
Compare three complete mappings for the same values
Download the original labelled SVG
On a narrow screen, scroll inside the table. The region can receive keyboard focus.
| Change in fictional units | Min/max -4..12 | Symmetric -12..12 | Piecewise -4..0..12 |
|---|---|---|---|
| -4 | 0.000000 | 0.333333 | 0.000000 |
| -2 | 0.125000 | 0.416667 | 0.250000 |
| 0 | 0.250000 | 0.500000 | 0.500000 |
| 2 | 0.375000 | 0.583333 | 0.583333 |
| 4 | 0.500000 | 0.666667 | 0.666667 |
| 8 | 0.750000 | 0.833333 | 0.833333 |
| 12 | 1.000000 | 1.000000 | 1.000000 |
Download all original values and computed coordinates
Every supplied value is within each stated domain. The symmetric model deliberately reserves the unused -12 to -4 region. That makes the observed negative values occupy less of the palette, while retaining a common distance rule for equal positive and negative magnitudes.
Calculate what each rule actually does
minmax(v) =(v+4)/16
symmetric(v) =(v+12)/24
piecewise(v) =0.5+v/8 when -4 <=v <0
piecewise(v) =0.5+v/24 when 0 <=v <=12For the min/max rule, zero becomes 4/16=0.25. The mathematical midpoint of -4 and 12 is 4, so 4 becomes 0.5. Calling the neutral midpoint “zero” while using that rule would contradict the actual mapping.
For the symmetric rule, choose M=max(abs (-4), abs (12))=12. The range is -M to M, and zero becomes 12/24=0.5. Both -4 and +4 lie one sixth of the palette range from the center. They encode equal absolute magnitude symmetrically.
The piecewise rule uses a separate slope on each side. It makes -4 the lower endpoint, zero the middle and 12 the upper endpoint. Here -4 is 0.5 coordinate units from the center, but +4 is only 1/6 from it. This model preserves the sign center while giving each observed side the whole half-range; it does not preserve equal magnitude distance.
Choose according to the comparison, not the fullest palette
If readers are comparing equal-sized losses and gains, a common symmetric magnitude rule is a defensible choice. Explain the unused negative extent so a reader does not mistake it for observed data. Use the actual unit, such as a difference in counts or percentage points, rather than an undefined “change”.
If each side has its own meaningful levels, an asymmetric or piecewise scheme may serve that task. Publish the exact side-specific breaks or endpoints. A legend that shows only two hues and a center cannot reveal the different numeric slopes.
Basis: [4]
A dataset entirely above zero may be better served by a sequential scale unless the absent negative side is still relevant to the question. Keep the reference value when comparison across periods requires it; do not recompute the domain independently per panel and then imply that the same shade means the same value.
The chosen rule should stay in the data documentation. A designer’s desire to use every saturated color is not sufficient reason to change the interpretation of magnitude.
Write the sign, reference and scale into the visible chart
Show actual signed values and the unit in the data table or cells. Label the neutral point as “zero change” when that is its meaning. Do not rely on recognizing blue or orange to tell whether a change is above or below the reference.
Basis: [1]
A zero-centered palette does not make a zero cell the same as an unavailable observation. Keep missing data separate and link to the missing-versus-zero example when those states occur. Zero remains a numeric observation in this constructed dataset.
Check any text on a colored fill against its actual background. A numeric palette can have pale and dark cells needing different label colors. The continuous encoding and any essential presentation question should be evaluated in context; this article is not claiming that every adjacent shade must achieve 3: 1.
For export, retain the domain, midpoint, unit and complete values. A screenshot of a smooth legend is insufficient to reconstruct the coordinate model if its numeric labels have been cropped.
Try three center and magnitude checks
Use the exact -4..12 input range and the three displayed formulas.
Case 1
Does ordinary min/max normalization make zero the palette midpoint for -4..12?
Show answer and explanation for case 1
No. Zero becomes 0.25.
The midpoint value is 4. A palette with a neutral point at 0.5 therefore needs a different domain or mapping to place zero there.
Case 2
Which displayed rule places -4 and +4 equally far from a zero center?
Show answer and explanation for case 2
The symmetric -12..12 rule.
Its coordinates are 1/3 and 2/3, each 1/6 from 0.5. The piecewise rule uses different slopes and is not magnitude-symmetric.
Case 3
Is a piecewise zero-centered scale necessarily invalid?
Show answer and explanation for case 3
No. It can express a deliberate side-specific comparison.
It keeps zero at 0.5 but uses distinct negative and positive slopes. State that rule and the numeric legend rather than implying symmetric magnitude.
Sources and further reading
- W3C: Understanding Use of Color, SC 1.4.1Visible alternatives to color-assigned meaning, including the distinction between visible cues and information supplied only to assistive technology.
- W3C: Understanding Non-text Contrast, SC 1.4.11Required graphical information, actual adjacent pairs, chart-edge examples and equivalent visible labels and values.
- W3C: Understanding Contrast (Minimum), SC 1.4.3Ordinary-text 4.5: 1 and qualifying-large-text 3: 1 thresholds, unrounded comparisons and sRGB luminance/contrast definitions.
- ColorBrewer: Sequential, diverging and qualitative schemesSequential, diverging and qualitative schemes; ordered values, categorical identity and a meaningful central reference.