'Remove "0%" labels from a plotly pie chart in Python
Solution 1:[1]
I could fix a limit to the labels using two parameters: uniformtext_minsize and uniformtext_mode:
fig.update_traces(textposition='inside')
fig.update_layout(
height=400,
width=430,
uniformtext_minsize=10, uniformtext_mode='hide',
legend=dict(font=dict(size=12)),
margin=dict(
l=0,
r=0,
b=0,
t=50,
pad=0
)
As Plotly adjusts the font size to fit labels inside pie slices, those parameters hide the label if it was impossible to show it inside the slice using uniformtext_minsize font size, as it can be seen below:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | smartexpert |