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

  • They effectively show both the hierarchy structure and proportional sizes at each level, with interactive versions supporting drill-down exploration.

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 = 900
figsize_height = 700

# === 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=50, l=10, r=10, b=10)
)

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

Pro Tips

Use distinct colors per level

Enable click-to-zoom interaction

Show breadcrumb for navigation

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.