Scale
A visualization scale maps data values to visual values such as positions, colors, or sizes.
D3.js in Action, Third Edition
A scale maps data values to visual values such as size, color, or screen position.
- How it is used
- Translates prepared data into visual attributes while constructing D3 charts.
- How deep it goes
- Defines domains, ranges, continuous values, and discrete values, then demonstrates scaleLinear without covering every scale family.
- Examples
- Uses bar charts, TV-series ratings, gendered salary box plots, scatterplots, and a scaleLinear mapping from 0–200 to 0–20.
- What you can do after
- Apply it via D3 by configuring a domain and range, evaluating the scale, and assigning outputs to chart attributes.
Data Storytelling with Altair and AI
A visualization scale maps data values to visual values such as positions, colors, or sizes.
- How it is used
- Maps data values to visual outputs, especially colors, while constructing readable Altair charts.
- How deep it goes
- Defines domains, ranges, and schemes with examples, but stops short of explaining scale internals.
- Examples
- Uses category-colored bars, quantitative blue-to-red mappings, and country lines colored with the set2 scheme.
- What you can do after
- Apply it via Altair to configure color palettes, domains, and ranges for encoded chart values.
Read how Data Storytelling with Altair and AI explains scale →
Related concepts
- axis generatorused by · An axis generator is a D3 function that constructs SVG elements representing a chart axis from a scale.
- band scaleincludes · A band scale maps discrete input values to continuous positions while allocating an equal-width band for each input value.
- linear scaleincludes · A linear scale maps continuous input values to output values through a linear relationship between its domain and range.
- ordinal scaleincludes · An ordinal scale maps discrete domain values to discrete range values while preserving their categorical association.
- range()configured by · range() is a visualization-scale method or parameter that sets or specifies the scale’s output values.
Questions about scale
What is scale?
A visualization scale maps data values to visual values such as positions, colors, or sizes.
Which Manning books explain scale?
D3.js in Action, Third Edition and Data Storytelling with Altair and AI.
What kinds of scale are there?
Kinds of scale include band scale, linear scale and ordinal scale.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

