Skip to content

Sunburst Charts

When to use sunburst charts

Sunburst charts are for hierarchical breakdowns, where each level nests inside the one before it:

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

The center ring is the top of the hierarchy; each ring further out is one level deeper. A segment’s angle (arc width) is proportional to its value, so you can see both “how big is this branch” and “how does it split further” in one picture. Use sunbursts when the hierarchy itself is part of the story — not just as a fancier pie chart.

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()

path=["region", "city"]path=["region", "city"] tells Plotly the nesting order (outermost group first); values="sales"values="sales" sizes every arc. Clicking a ring segment in the rendered chart zooms into that branch — a built-in drill-down for free.

sketch Sunburst = concentric rings, one per hierarchy level p5.js
The inner ring is region, the outer ring is city — each arc's width is proportional to its sales value.

Tip

If your hierarchy is large, sunburst can become cluttered — thin outer rings become unreadable slivers. Consider bar charts (or a treemap) for top-level summaries, and reserve the sunburst for cases where the drill-down interaction genuinely helps.

diagram Building a sunburst mermaid
Each path level becomes one ring; the ring's arcs are sized by the values column.

Next

Continue to: 3D Scatter Plots for exploring three numeric variables at once.

🧪 Try It Yourself

Exercise 1 – Define the Hierarchy Path

Exercise 2 – Size Arcs by a Value Column

Exercise 3 – Three-Level Hierarchy

If this helped you, consider buying me a coffee ☕

Buy me a coffee

Was this page helpful?

Let us know how we did