Menu

Hierarchical
Interactive
37 Python scripts generated for sunburst diagram this week

Sunburst Diagram

Chart overview

Sunburst diagrams represent hierarchical data as concentric rings, with the hierarchy flowing from center to outer rings.

Key points

  • Each ring corresponds to one level of the hierarchy, each segment's angle is proportional to its value, and segments are nested inside their parent, so the diagram shows both structure and relative size in a single view.
  • In Python the standard tool is Plotly: px.
  • sunburst builds the chart straight from a DataFrame using a path argument that lists the hierarchy columns, while go.

Practical guidance

Sunburst takes explicit labels, parents, and values arrays for full control. Interactive versions support click-to-zoom drill-down - clicking a segment makes it the new center so deep hierarchies stay explorable - plus hover tooltips showing absolute values and percent of parent. Sunbursts shine when the hierarchy is the story: disk usage by folder, budget lines by department, taxonomies, and survey answers by segment. For comparing precise values across deep levels a treemap or icicle chart is often easier to read, since rectangular areas are simpler to judge than arc lengths.

Create a Sunburst Diagram with your data using AI — no coding required.

Python Tutorial

How to create a sunburst diagram in Python

Use the full tutorial for implementation details, troubleshooting, and chart variations in matplotlib, seaborn, and plotly.

Complete Guide to Scientific Data Visualization

Interactive Visualization

Loading interactive chart...

This is an interactive sunburst diagram. You can zoom, pan, and hover over elements for details.

Create This Chart Now

Generate publication-ready sunburst diagrams with AI in seconds. No coding required – just describe your data and let AI do the work.

View example prompt
Example AI Prompt

"Create an interactive sunburst diagram showing 'File System Storage Usage' for a development machine. Generate a hierarchical structure: Root (500GB total) → 'Documents' (120GB: Projects 80GB, Personal 40GB) → 'Projects' subdivides into 'WebApps' (35GB: React 15GB, Vue 10GB, Angular 10GB), 'DataScience' (25GB: Notebooks 10GB, Datasets 15GB), 'Mobile' (20GB). Add 'Media' (200GB: Videos 120GB, Photos 60GB, Music 20GB), 'Applications' (80GB), 'System' (50GB), 'Other' (50GB). Sector angle proportional to size. Color by file type category. Add hover showing full path, size in GB, and percentage of parent. Enable drill-down on click. Display current path and total size at center. Add breadcrumb navigation. Title: 'Storage Usage Analysis - 500GB Drive'."

How to create this chart in 30 seconds

1

Upload Data

Drag & drop your Excel or CSV file. Plotivy securely processes it in your browser.

2

AI Generation

Our AI analyzes your data and generates the Sunburst Diagram code automatically.

3

Customize & Export

Tweak the design with natural language, then export as high-res PNG, SVG or PDF.

Newsletter

Get one weekly tip for better sunburst diagrams

Join researchers receiving concise Python plotting techniques to improve chart clarity and reduce revision cycles.

No spam. Unsubscribe anytime.

Python Code Example

example.py
# === IMPORTS ===
import pandas as pd
import numpy as np
import plotly.express as px

# === USER-EDITABLE PARAMETERS ===
title = "File System Storage Usage - 500GB Drive"
figsize_width = 720
figsize_height = 560

# === EXAMPLE DATASET ===
# Hierarchical file system structure
np.random.seed(42)

data = {
    'Category': [],
    'Subcategory': [],
    'Size_GB': []
}

storage_data = {
    'Documents': [
        ('Projects', 80),
        ('Personal', 40),
    ],
    'Media': [
        ('Videos', 120),
        ('Photos', 60),
        ('Music', 20),
    ],
    'Applications': [
        ('Development Tools', 35),
        ('Office Suite', 25),
        ('Games', 20),
    ],
    'System': [
        ('Windows', 30),
        ('Drivers', 10),
        ('Cache', 10),
    ],
    'Other': [
        ('Downloads', 30),
        ('Backups', 20),
    ],
}

for category, subcats in storage_data.items():
    for subcat, size in subcats:
        data['Category'].append(category)
        data['Subcategory'].append(subcat)
        data['Size_GB'].append(size)

df = pd.DataFrame(data)

# Print summary
print("=== Storage Usage Summary ===")
print(f"\nTotal Storage Used: {df['Size_GB'].sum()}GB")
print(f"\nBy Category:")
print(df.groupby('Category')['Size_GB'].sum().sort_values(ascending=False).to_string())

# === CREATE SUNBURST ===
fig = px.sunburst(
    df,
    path=['Category', 'Subcategory'],
    values='Size_GB',
    title=title,
    color='Size_GB',
    color_continuous_scale='Reds'
)

fig.update_layout(
    width=figsize_width,
    height=figsize_height,
    margin=dict(t=70, l=20, r=20, b=20),
    autosize=True
)

fig.update_traces(
    hovertemplate='<b>%{label}</b><br>Size: %{value}GB<br>%{percentParent:.1%} of parent<extra></extra>'
)

fig.show()
# END-OF-CODE

Opens the Analyze page with this code pre-loaded and ready to execute

Console Output

Output
Total Storage: 500GB
Used Storage: 500GB
Free Storage: 0GB
Largest Category: Media (200GB, 40.0%)

Common Use Cases

  • 1File system visualization
  • 2Organizational hierarchies
  • 3Budget breakdowns
  • 4Product category exploration
  • 5Website navigation path analysis
  • 6Biological and taxonomy classifications

Pro Tips

Use distinct colors per level

Enable click-to-zoom interaction

Show breadcrumb for navigation

Keep hierarchies to 3-4 rings; deeper levels become unreadable slivers

Use px.sunburst with a path argument to build straight from a DataFrame

Set maxdepth in Plotly to limit visible rings and rely on drill-down

Frequently asked questions

When should you use a sunburst diagram?

Sunburst diagrams represent hierarchical data as concentric rings, with the hierarchy flowing from center to outer rings. Each ring corresponds to one level of the hierarchy, each segment's angle is proportional to its value, and segments are nested inside their parent, so the diagram shows both structure and relative size in a single view. Common applications include file system visualization, organizational hierarchies, and budget breakdowns.

Which Python libraries can create a sunburst diagram?

A sunburst diagram can be built in Python with plotly — Plotly for interactive hover, zoom, and web sharing. In Plotivy you describe the figure and it writes the plotly code for you.

Can I make a sunburst diagram without writing Python code?

Yes. Describe the sunburst diagram you need in plain language and upload your dataset — Plotivy's AI writes the Python code and renders a publication-ready figure. You still get the full, editable plotly source, so nothing is locked in a black box.

What are best practices for a clear sunburst diagram?

Use distinct colors per level. Enable click-to-zoom interaction.

Long-tail keyword opportunities

how to create sunburst diagram in python
sunburst diagram matplotlib
sunburst diagram seaborn
sunburst diagram plotly
sunburst diagram scientific visualization
sunburst diagram publication figure python

High-intent chart variations

Sunburst Diagram with confidence interval overlays
Sunburst Diagram optimized for publication layouts
Sunburst Diagram with category-specific color encoding
Interactive Sunburst Diagram for exploratory analysis

Library comparison for this chart

plotly

Best for interactive hover, zoom, and web sharing when collaborators need to inspect values directly from sunburst-diagram figures.

Free Cheat Sheet

Scientific Chart Selection Cheat Sheet

Not sure whether to use a Violin Plot, Box Plot, or Ridge Plot? Download our single-page reference mapping the most-used scientific chart types, exactly when to use them, and the core Matplotlib/Seaborn functions.

Comparison Charts
Distribution Charts
Time Series Data
Common Mistakes
No spam. Unsubscribe anytime.