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.