Sunburst Chart
Linux Filesystem Hierarchy
Dark-themed sunburst chart showing Linux filesystem hierarchy from root to major directories to subdirectories.
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 - Root directories
root_sizes = [25, 20, 20, 15, 10, 10]
root_labels = ['/home', '/var', '/usr', '/etc', '/opt', '/tmp']
root_colors = ['#6CF527', '#27D3F5', '#F5276C', '#F5B027', '#5314E6', '#C82909']
# Outer ring - Subdirectories
sub_sizes = [10, 8, 7, 8, 7, 5, 8, 7, 5, 8, 7, 5, 5, 5, 5]
sub_colors = ['#6CF527', '#8FFF5C', '#4DB31F',
'#27D3F5', '#5CE8FF', '#1A9FBA',
'#F5276C', '#FF5A94', '#C21F56',
'#F5B027', '#FFCC5C',
'#5314E6', '#7B4DFF',
'#C82909', '#F54927']
wedges_outer, _ = ax.pie(sub_sizes, radius=1, colors=sub_colors,
wedgeprops=dict(width=0.3, edgecolor='#0a0a0f', linewidth=2))
wedges_inner, _ = ax.pie(root_sizes, radius=0.7, colors=root_colors,
wedgeprops=dict(width=0.3, edgecolor='#0a0a0f', linewidth=2))
# Add root directory labels
for i, (wedge, label) in enumerate(zip(wedges_inner, root_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, '/\n485 GB', ha='center', va='center',
fontsize=14, color='white', fontweight='bold')
# Legend
sub_labels = ['user/', 'shared/', 'backups/', 'log/', 'lib/', 'cache/',
'local/', 'share/', 'bin/', 'nginx/', 'ssh/',
'apps/', 'tools/', 'cache/', 'uploads/']
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('Linux Filesystem', fontsize=18, color='#f8fafc',
fontweight='bold', pad=20)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Part-to-Whole
More Sunburst Chart examples
☕