Skip to main content
100%

Discrete vs continuous diverging scales with d3-scale-chromatic

✓ Published0🌍 Public
Aandyreagan
Last edited Jun 6, 2018
Created on Jun 6, 2018

This example compares discrete and continuous diverging color scales by rendering 2,000 thin vertical lines on a Canvas, with a translucent SVG overlay for the axis. The top band uses a `d3.scaleThreshold` with a domain divided into five steps and the `d3.schemePuOr` array, producing sharp color boundaries. The bottom band uses a `d3.scaleSequential` with `d3.interpolatePuOr` over a continuous [-1, 1] domain, creating a smooth gradient. Both scales map the same input range, and the code relies on d3.v4 and d3-scale-chromatic to draw the comparison.

AI-generated description

An example to ilustrate the difference of using d3.scaleThreshold vs d3.scaleSequential for creating discrete vs continuous diverging scales using d3.v4 and d3-scale-chromatic

See also sequential scales

Built with blockbuilder.org

forked from <a href='http://bl.ocks.org/john-guerra/'>john-guerra</a>'s block: <a href='http://bl.ocks.org/john-guerra/17fe498351a3e70929e2e36d081e1067'>Discrete vs continuous diverging scales with d3-scale-chromatic</a>

mit Licensed

Similar vizzes