Open
Description
In some line plots, if the cardinality of z is relatively low, it would be nice to label the lines say at the start or end. Similarly for dot plots, it would be lovely to have an automatic labeling strategy. Related vega-label.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
[-]Automatic labeling?[/-][+]Labeling algorithms (e.g., occlusion)?[/+]mbostock commentedon Feb 24, 2021
Related #139 for a transform that is useful for labeling lines.
Fil commentedon Mar 5, 2021
we have a nice solution for stacked series and bars thanks to stackXMid
mbostock commentedon Mar 18, 2021
I really want an automatic algorithm for labeling scatterplots. And possibly stacked areas and other things. Something that considers only occlusion, like @fil/occlusion, would be a great place to start.
Fil commentedon Sep 27, 2021
I also like the "halo" (white stroke clone) strategy from https://observablehq.com/@mbostock/inequality-in-american-cities and think it should be available from Plot.text (and maybe occlusion as well!).
Other refs:
Fil commentedon Mar 29, 2022
Here's a prototype for a labelling strategy based on @fil/occlusion
https://observablehq.com/@observablehq/plot-occlusion-27
On this scatterplot, the occludeText function is able to avoid putting text on top of symbols. It's still not capable of finding a correct position to put the texts. It also needs to wait for the chart to be appended to the DOM before it can kick in, as it needs to measure the actual bounding boxes.
mbostock commentedon Mar 29, 2022
Can we avoid getBoundingClientRect by using the same metrics approach that Plot.text uses?
Fil commentedon Mar 29, 2022
Yes it's one of the todos. Some challenges (probably not too hard):
Fil commentedon Dec 8, 2022
Voronoi centroid initializer https://observablehq.com/@fil/plot-voronoi-labels
Fil commentedon Mar 23, 2023
A typical request is to limit occlusion of end-of-line labels, like in https://observablehq.com/@d3/cancer-survival-rates (unfinished Plot version: https://observablehq.com/@observablehq/plot-cancer-survival-rates). The dodgeY transform doesn't address this concern since by construction it disregards an initial y channel.
I wonder if it would be fair for the dodgeY transform to switch to a different algorithm if y is already there?
Fil commentedon Apr 4, 2023
See also mapbox’s text-variable-anchor property
https://docs.mapbox.com/mapbox-gl-js/example/variable-label-placement/
4 remaining items