@kate @emma_cogdev
You can duct tape together it by (1) identifying transitive sets of overlapping labels (e.g. A touches B, B touches C, so [A,B,C] is a group), (2) respacing each overlap group so labels do not overlap, (3) then vertically adjusting the respaced group to minimize sum of squares of displacements from original label positions, and (4) repeating the whole algorithm until nothing moves. I’m sure there’s a more efficient way, though!
Conversation
Notices
-
Embed this notice
Paul Cantrell (inthehands@hachyderm.io)'s status on Saturday, 06-Jul-2024 05:10:30 JST Paul Cantrell -
Embed this notice
Kate Morley (kate@fosstodon.org)'s status on Saturday, 06-Jul-2024 05:10:31 JST Kate Morley Does anyone know the algorithm used for laying out labels like this? The aim is to minimise the vertical distance of labels from their points while preventing them from overlapping. With two labels you can just move them equally far from their common centre if they would overlap, but with more labels this could then introduce new overlaps, so it’s not so trivial. I tried searching but all I could find were algorithms for two-dimensional placement of labels on maps.
-
Embed this notice