scatter rectangles
This example shows a scatterplot where each point is a rectangle, with its width and height encoded as, well, width and height—the actual visual size of the rectangle corresponds to the data values. The visualization uses a force-directed layout with a custom rectangle-collision constraint, so the rectangles push apart and settle into a non-overlapping arrangement. Rendered as an animated SVG, the rectangles drift and rearrange themselves in response to the forces, creating a dynamic, organic distribution. The code builds on an earlier rectangle-force block by Elijah Meeks and uses D3's force module (d3-force v1.0.0) along with the d3v4+jetpack convenience library. The animation makes the spatial encoding of each rectangle's dimensions immediately visible as the rectangles jostle and find their positions.
AI-generated descriptionUsing a force layout to encode sepial width and height as, uh, width and height.
Rectangle force from: http://bl.ocks.org/emeeks/b3851789fcc3bf0c65ea9a34c3dca7bb
See also: http://bl.ocks.org/mbostock/4055889