Skip to main content
100%

Voronoi binning (animated)

✓ Published0🌍 Public
AAjayyy
Last edited Jun 17, 2019
Created on Jun 17, 2019

This animated visualization demonstrates Voronoi binning: 4,000 random points are generated, then sorted by size, with the top 10% selected as Voronoi sites. Initially, all dots appear white, but after a delay, the larger site points are colored, and then every other point is recolored according to the site of its Voronoi cell, found via the `diagram.find` method. The animation uses `d3.interval` to repeat the algorithm, `d3.voronoi` for the diagram, and D3 transitions to fade polygons and dots in and out, rendering in SVG.

AI-generated description

Group data points around the largest points.

The recipe is as follows:

  1. sort data points according to their sizes (here size = d[3])

  2. use top 10% points as Voronoi sites

  3. bin all data points according to their Voronoi cell, using <a href='http://bl.ocks.org/Fil/1b7ddbcd71454d685d1259781968aefc'>voronoi.find()</a>. The binning is rendered by using the Voronoi sites's color.

See also the <a href="//bl.ocks.org/Fil/7c3c41f1524dcf2caea54290cceddf0a">static version</a> — much less code to parse!

Original work by Philippe Rivière for d3-voronoi (issue 17).

forked from <a href='http://bl.ocks.org/Fil/'>Fil</a>'s block: <a href='http://bl.ocks.org/Fil/959437d834f4a01eb4d1023cdd107554'>Voronoi binning (animated)</a>

gpl-3.0 Licensed

Similar vizzes