Accurate Beeswarm Plot Example

This page is based on Henry Lau's beeswarms.

The data is more-or-less random, and all three plots are accurate beeswarms displaying the same data. The first plot uses d3-beeswarm. The second plot uses a new method. This begins by placing points from left to right with a y-coordinate of zero, without overlap. Then, it finds a point that can be added as close as possible to the y=0 line without overlapping any point that has already been placed (breaking ties by preferring points with low x values). This process is continued until all the points have been placed. The x values are not modified.

The third plot uses the new method with random tie-breaking. This seems to pack the dots together quite neatly while avoiding the honeycomb effect of the middle plot.

Reload the page to load new random data with more or fewer points.

View the library on GitHub