# Correct location for a pie chart internal label

I'm producing pie charts algorithmically. In many cases, each segment of a pie chart should contain a label inside the segment (space permitting). Where exactly should the label be placed in order to be more-or-less perceptually centered?

My leading approach is to inscribe a circle inside the segment and center the label inside that circle. Then, if the label does not fit in the circle, it will have to be moved outside the chart.

An alternative is the centroid of the section. To me, this didn't look quite as good.

Is there a common convention for this? Is there an approach often taken by high-quality tools that I should be aware of?

Example of the inscribed circle approach:

• I honestly don't think there's any formula for this beyond "what looks good". Commented May 17, 2017 at 16:50
• Your algorithm is fine and will work but the center of a shape is not always the best place to have a title. The \$100 may look more balanced in the chart if it was up next to the blue pie piece, or under the tip, centered. Correct placement is found through the balance of up/down, left/right and empty space. Commented May 17, 2017 at 19:47
• True, but the trick is expressing the notion of balance algorithmically. Is there an alternative algorithm or a modification of this algorithm that you think may provide better results in some cases? I'm not bound to this algorithm, or even to using the same algorithm in all cases. (As a trivial example, my implementation has special cases for segments that constitute more than half the pie and for segments that take up the entire pie.) Commented May 17, 2017 at 21:53
• Alternative - Centered on area arc relative to outer curve (and 25% is actually 25%) - Not necessarily better, just different. Which is really all any solutions will be. Commented May 18, 2017 at 22:55