Skip to main content
100%

Color and Size Legends

✓ Published0🌍 Public
BBrandon Lehr
Last edited Aug 22, 2019
Created on Aug 22, 2019

This example demonstrates two legend types for scatterplot-style data: a color legend mapping categorical values to distinct hues, and a size legend using a square-root scale to encode continuous numeric magnitudes. Both legends render as SVG groups containing circles and text labels, with the color legend using `d3.scaleOrdinal` and the size legend using `d3.scaleSqrt` with tick generation from `sizeScale.ticks`. The legends are positioned manually via SVG transforms and styled with CSS classes for the tick marks.

AI-generated description
MIT Licensed

Similar vizzes