liveBook · Manning

Sequential colormap

As explained in D3.js in Action, Third Edition

A sequential color palette is an ordered progression of colors that encodes increasing or decreasing magnitude.

A sequential colormap encodes increasing or decreasing magnitude with an ordered progression of colors. It suits quantitative or ordinal data when colors should communicate low-to-high values. section 13.2.3 section 3.1.2

Build a sequential color scale by:

  • Choosing a continuous domain for the values being visualized. section 13.2.3
  • Passing an interpolator such as d3.interpolateYlGnBu to d3.scaleSequential(), rather than setting a separate range. section 13.2.3
  • Capping the upper domain when an extreme value would make most observations visually indistinguishable. section 13.2.3
  • Providing a separate neutral color for missing or zero-valued regions when appropriate. section 13.2.3

Coloring a choropleth map

A Nobel-laureate map uses d3.interpolateYlGnBu: countries with fewer laureates appear yellow, intermediate values turquoise, and larger values dark blue. The scale uses .domain([1, 100]); each country receives countryColorScale(d.properties.laureates.length), while countries with no laureates receive #f8fcff. section 13.2.3

How D3.js in Action, Third Edition covers it

How deep it goes
Explains continuous domains, interpolators, domain caps, and conditional fills through a working map implementation.
Examples
Uses a Nobel-laureate world map, the YlGnBu interpolator, a capped domain, and a neutral zero-value fill.
What it assumes
Assumes basic data-type distinctions and introduces how those distinctions guide visualization and D3 scale selection.
What you can do after
Apply it via D3 to map numerical values onto continuous color ranges and improve readability around outliers.
How it connects
Connects sequential palettes with quantitative data, ordinal data, choropleth maps, D3 scales, and color interpolation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of D3.js in Action, Third Edition. The section links point to the parts of the book it draws on.