Skip to content

Sunburst Charts

When to use sunburst charts

Sunburst charts are for hierarchical breakdowns:

  • Region → City → Store
  • Category → Subcategory → Product

Use them when hierarchy matters.

Example

Sunburst
import pandas as pd
import plotly.express as px
 
df = pd.DataFrame({
    "region": ["West", "West", "North", "North"],
    "city": ["Pune", "Mumbai", "Delhi", "Chandigarh"],
    "sales": [120, 90, 180, 60],
})
 
fig = px.sunburst(df, path=["region", "city"], values="sales", title="Sales hierarchy")
fig.show()
Sunburst
import pandas as pd
import plotly.express as px
 
df = pd.DataFrame({
    "region": ["West", "West", "North", "North"],
    "city": ["Pune", "Mumbai", "Delhi", "Chandigarh"],
    "sales": [120, 90, 180, 60],
})
 
fig = px.sunburst(df, path=["region", "city"], values="sales", title="Sales hierarchy")
fig.show()

Tip

If your hierarchy is large, sunburst can become cluttered—consider bar charts for top-level summaries.

If this helped you, consider buying me a coffee ☕

Buy me a coffee

Was this page helpful?

Let us know how we did