Discrete vs continuous sequential scales with d3-scale-chromatic
This example contrasts discrete and continuous sequential color scales by drawing two bands of vertical lines on a canvas, with an SVG axis overlay. The top band uses a `d3.scaleThreshold` with `d3.schemeGreens[5]` to produce five distinct color steps, while the bottom band uses a `d3.scaleSequential` with `d3.interpolateGreens` for a smooth gradient. Both map a 0–100 domain to color, with lines sampled every 0.001 units. The code renders 100,000 lines per band using the Canvas 2D API for speed, while D3 v4 and d3-scale-chromatic handle the scales and axis.
AI-generated descriptionAn example to ilustrate the difference of using d3.scaleThreshold vs d3.scaleSequential for creating discrete vs continuous sequential scales using d3.v4 and d3-scale-chromatic
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>
forked from <a href='http://bl.ocks.org/john-guerra/'>john-guerra</a>'s block: <a href='http://bl.ocks.org/john-guerra/a75733ba5767813d4f31026d1d5e6244'>Discrete vs continuous sequential scales with d3-scale-chromatic</a>