Quantcast
Viewing all articles
Browse latest Browse all 14069

Empty page when generating sunburst chart

I was trying to write a function to generate sunburst chart, but the figure shows a blank page. There are no error message. Then I was testing with simple sample data (see below) but it is still blank. When I use plotly.express instead plotly.graph_objects then it works. Anyone know why? Thanks for the help!

import pandas as pdimport plotly.graph_objects as go# Sample datadata = {'Category': ['A', 'A', 'B', 'B'],'Subcategory': ['A1', 'A2', 'B1', 'B2'],'Value': [10, 20, 30, 40]}df = pd.DataFrame(data)# Create a basic sunburst chartfig = go.Figure(go.Sunburst(    labels=df['Subcategory'],    parents=df['Category'],    values=df['Value']))fig.update_layout(margin=dict(t=0, l=0, r=0, b=0))# Save the chart to an HTML filefig.write_html('basic_hierarchical_sunburst_chart.html')

Viewing all articles
Browse latest Browse all 14069

Trending Articles