Plotly Pie Chart Label - Inside & Outside with Proper Style

Hi everyone,

I hope to make a pie chart, with at least 20-30 sectors. The inside labels work fine, but the outside labels almost overlap and look messy, affecting the whole chart layout.

Here is the chart with issue:

My desired output is to include all labels, either inside or outside to make everything looks tidy and readable.

I do not want to turn all into inside labels, so the following code doesn’t fit.

fig.update_layout(uniformtext={'minsize': 12, 'mode': 'hide'},

May I know if there is any method to make the desired pie chart?

Reference:

  1. Pie chart labels annotation arrow direction
  2. Hiding % labels in px.pie chart python - #2 by nirvikalpa