Sunburst Chart
Project Directory Structure
Dark-themed sunburst chart visualizing a software project file system hierarchy showing folders and file distributions.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(figsize=(12, 10), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
# Inner ring - Main folders
folder_sizes = [35, 25, 20, 12, 8]
folder_labels = ['src/', 'tests/', 'docs/', 'config/', 'scripts/']
folder_colors = ['#6CF527', '#27D3F5', '#F5B027', '#F5276C', '#5314E6']
# Outer ring - Subfolders
sub_sizes = [15, 12, 8, 10, 8, 7, 10, 6, 4, 6, 6, 4, 4]
sub_colors = ['#6CF527', '#8FFF5C', '#4DB31F',
'#27D3F5', '#5CE8FF', '#1A9FBA',
'#F5B027', '#FFCC5C', '#C28A1F',
'#F5276C', '#FF5A94',
'#5314E6', '#7B4DFF']
wedges_outer, _ = ax.pie(sub_sizes, radius=1, colors=sub_colors,
wedgeprops=dict(width=0.3, edgecolor='#0a0a0f', linewidth=2))
wedges_inner, _ = ax.pie(folder_sizes, radius=0.7, colors=folder_colors,
wedgeprops=dict(width=0.3, edgecolor='#0a0a0f', linewidth=2))
# Add folder labels
for i, (wedge, label) in enumerate(zip(wedges_inner, folder_labels)):
ang = (wedge.theta2 - wedge.theta1) / 2 + wedge.theta1
x = 0.55 * np.cos(np.radians(ang))
y = 0.55 * np.sin(np.radians(ang))
ax.text(x, y, label, ha='center', va='center', fontsize=10,
color='white', fontweight='bold')
centre_circle = plt.Circle((0, 0), 0.4, fc='#0a0a0f', ec='#334155', linewidth=2)
ax.add_artist(centre_circle)
ax.text(0, 0, 'project/\n1,247 files', ha='center', va='center',
fontsize=12, color='white', fontweight='bold')
# Legend
sub_labels = ['components/', 'utils/', 'api/', 'unit/', 'integration/', 'e2e/',
'api-docs/', 'guides/', 'examples/', 'env/', 'deploy/', 'build/', 'ci/']
ax.legend(wedges_outer, sub_labels, loc='center left', bbox_to_anchor=(1.05, 0.5),
fontsize=9, frameon=True, facecolor='#1e293b', edgecolor='#334155',
labelcolor='white', title='Subdirectories', title_fontsize=10)
ax.set_title('Project File Structure', fontsize=18, color='#f8fafc',
fontweight='bold', pad=20)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Part-to-Whole
More Sunburst Chart examples
☕