observablehq / plot

A concise API for exploratory data visualization implementing a layered grammar of graphics
https://observablehq.com/plot/
ISC License
4.41k stars 176 forks source link

Repulsive labels #1159

Open allisonhorst opened 1 year ago

allisonhorst commented 1 year ago

For charts with dense or overlapping labels, it would be useful to have a way to create repulsive labels to avoid overlap (similar to ggrepel for ggplot2).

Fil commented 1 year ago

This might be needing an algorithm similar to Dorling cartograms, for example with a force simulation.

Among the notable differences/or features that we might want to support:

mbostock commented 1 year ago

Probably already covered by #27, but we could leave this open if there’s specifically demand for this type of labeling algorithm.

Fil commented 1 year ago

Or use a voronoi initializer transform: https://observablehq.com/@fil/plot-voronoi-labels

mbostock commented 1 year ago

Ref. https://www.andrewheiss.com/blog/2023/06/01/geocoding-routing-openstreetmap-r/