After some time searching online and inspecting the āfigureā property of a Sunburst component I canāt figure out how to change the labelās texts.
Just to make it clear what I mean by āinspecting the āfigureā property of a Sunburst componentā, see below the output of a āprint(sunburst_figure)ā.
Itās easy to see how to access (and therefore how to change) the āhovertemplateā, ātextinfoā, and others. But where is it the labelās texts āof entryā and āof rootā?
Thank you,
Hi @Danilo_BR, can you please share your code and just enough data for us to reproduce your sunburst plot?
Hi @jhupiterz , sure! Sorry not to do that before. Follows below.
# Imports.
import pandas as pd
import plotly.express as px
from dash import Dash, html, dcc
# Create a simple DataFrame.
df = pd.DataFrame(
{
'Name': {0: 'John', 1: 'Jane'},
'Value': {0: 4, 1: 6}
}
)
# Creates Dash app.
app = Dash(__name__)
# Creates the layout.
app.layout=html.Div([
dcc.Graph(
figure=px.sunburst(
data_frame=df,
path=['Name'],
values='Value'
).update_traces(textinfo='percent root+percent parent')
)
])
# Runs the app locally.
app.run_server(debug=True, port=8050)