✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
πŸ‡ Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

How to hide labels in sunburst?

how do i hide labels in sunburst chart?

they dont really look good if there are many sections, and sometimes the text even bigger that the section itself - it seems like a bug https://prnt.sc/sjwd03

BTW is there any way to hide the labels in particular layer only?

Hi @nirvikalpa you can hide labels which don’t fit inside sectors using uniformtext, as shown in this example. You can also remove the labels you want by setting them to an empty string in the labels parameter of the Sunburst chart, either all of them or just the ones you want to remove. For example

import plotly.express as px
df = px.data.tips()
fig = px.sunburst(df, path=['day', 'time', 'sex'], values='total_bill')
fig.update_traces(labels=['',] * len(fig.data[0]['labels']))
fig.show()
1 Like