London City Data

Quantitative colour

Values mapped to colour gradients

Principles

A quantitative colour scale is a continuous gradient of colour mapped to a sequential set of values.

  • Quantitative colour scales are commonly used to encode values on a (choropleth) map or the data points on a chart.

  • A sequential scale is a gradient of colour that runs in one direction.

  • A diverging scale "diverges" in two directions, typically negative and positive.

  • The higher the contrast with the background, the higher the value is assumed to be by the reader.

  • Colour scales should be perceptually even, so a reader can infer the correct value from the colour.

Practice

Quantitative colour scales

A quantitative colour scale is a continuous (smooth or stepped) gradient of colour that is mapped to a sequential set of values. These colour scales can be single-hued (e.g. light to dark blue), or multi-hued (e.g. red, to yellow, to blue).

These quantitative colour scales are commonly used to encode data on a (choropleth) map, or the value of data points on a chart.

Example

Choropleth map of London boroughs and their variable values

The choropleth map of London shows the rate of something at a borough level. The lowest value is 9% in Merton. The highest value is 97% in Hounslow. The mean value is 50%.

Sequential

A sequential colour scale is a gradient of colour (continuous or stepped) that runs in one direction. For example, on a light background, a gradient from light to dark blue, might be mapped to values that run from 1 to 100.

Typically, the higher the contrast with the background, the higher the value is assumed to be by the reader. On a light background, a domain of 1 to 100 would be mapped from light to dark blue. The darker blue having the higher contrast and so the higher value. The opposite is true in dark mode.

Generate a colour ramp

Sequential
blue
300
900
Mode

Diverging

A diverging colour scale works in the same way as the single “direction” sequential scale above, but it "diverges" in two directions, typically negative and positive.

Typically we use 2 diverging, single hue, stepped gradients, but a diverging colour scale can also be a continuous gradient of colour.

Example

Choropleth map of London boroughs and their variable values

The diverging choropleth map of London shows the change in count of something at a borough level. The lowest value is -96 in Tower Hamlets. The highest value is 97 in Hounslow. The mean value is 20. Three Boroughs have values of 0. Haringey, Waltham Forest, and Bexley.

Our default diverging scale, is red (negative) to blue (positive). This is to avoid any red/green perception issues, and is a simple augmentation of our default (positive) blue ramp.

With diverging scales, you may want to add a central neutral grey step between the positive/negative steps to indicate values that are truly zero. Zero values could get binned into the lowest positive step of a scale giving a false impression of that bin.

Note: You should avoid mapping uneven ranges of values to apparently even ranges of colour contrast.

For example, if the range of your data is not evenly distributed on either side of zero (e.g. -50 to +100), then that should be reflected in the scale and the legend.

Survey Data

Another use for a diverging colour scale is for visualising opinion.

Likert scale survey questions divide opinion into Agree - Neutral - Disagree, or Negative - Neutral - Positive. This is ideal to data to visualise with a diverging colour scale.

Example

Line chart of London variable values

The stacked bar chart shows yearly average data in 2015 vs 2021 for Variable A, B and C, measured in GBP (Pounds Sterling). The x axis ranges from £0 to £100,000. The y axis shows 2015 and 2021. The combined annual average for all variables was £105,503 in 2015 compared to £66,820 in 2021 (a change of around -£38,683). Variable A had the most significant change of -£19,328 in 2021 vs 2015.

Once again datawrapper have written a useful blog post about diverging bars, and how to position/scale your segments for clarity & comparison.

Interpolation

Interpolation is how the values in your data get mapped to the colours in your scale.

The simplest (and most instinctive) type of interpolation is “linear” interpolation. This is simply mapping the lowest value to the first colour, the highest value to the last colour, and interpolating linearly between both.

However, it’s not always the best interpolation to use, particularly if you have extreme outliers and uneven distribution of values in your data.

Editorial judgement is needed here in the choice of your interpolation… what aspect of the data are you trying to show? What insight are your readers trying to glean from the map or chart?

Your mapping or visualisation tool of choice will usually allow you to choose a different interpolation to apply to your colour scale. Most readers will assume a simple linear interpolation, so your choice may distort their interpretation. For that reason, it’s important your choice is clearly communicated to the user.

Lisa Charlotte Muth from Datawrapper has written another brilliant article exploring different interpolations. This quote from that article is a perfect summing up of the issue.

All maps are wrong, but some are useful

Lisa Charlotte Muth (after George Box)

Perceptually even

It’s important that colour scales are perceptually even. This means that a reader can infer the correct value from the colour without being misled by particularly bright or dark patches.

While multi-hued scales can help users differentiate between steps on a scale, perceptual unevenness can be an issue. This is because a scale may pass through hues that could be perceived as brighter (like yellow), and depending on your colour space, can create odd colour artefacts.

Don't use this

If you do need multi-hued colour scales, it’s best practice to use well established perceptually even ramps like the Viridis ramps.

Use this

Note: If you have more complex ramp generation needs, see the 'further reading' section (below) and use tools like gka.github.io/palettes and the obumbratta.com/colour.

When using the Obumbratta.com Colour Ramp Tool, you can match our internal ramp methodology with these settings: Correct Lightness: On, Intelligent Interpolation: Off, Maintain Input Colours: Off, Colour Space: BEZ LAB.


Further reading