Sunburst Chart
University Department Structure
Light-themed sunburst chart showing university organizational hierarchy from faculties to departments to research groups.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(figsize=(12, 10), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
# Inner ring - Faculties
faculty_sizes = [30, 25, 25, 20]
faculty_labels = ['Engineering', 'Sciences', 'Business', 'Arts']
faculty_colors = ['#276CF5', '#6CF527', '#F5B027', '#F5276C']
# Outer ring - Departments
dept_sizes = [10, 10, 10, 9, 8, 8, 9, 8, 8, 7, 7, 6]
dept_colors = ['#276CF5', '#4A8CFF', '#6BA3FF',
'#6CF527', '#8FFF5C', '#B2FF8C',
'#F5B027', '#FFCC5C', '#FFD98C',
'#F5276C', '#FF5A94', '#FF8CB8']
wedges_outer, _ = ax.pie(dept_sizes, radius=1, colors=dept_colors,
wedgeprops=dict(width=0.3, edgecolor='white', linewidth=2))
wedges_inner, _ = ax.pie(faculty_sizes, radius=0.7, colors=faculty_colors,
wedgeprops=dict(width=0.3, edgecolor='white', linewidth=2))
# Add faculty labels
for i, (wedge, label) in enumerate(zip(wedges_inner, faculty_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='white', ec='#e5e7eb', linewidth=2)
ax.add_artist(centre_circle)
ax.text(0, 0, 'University\n2,450 Staff', ha='center', va='center',
fontsize=12, color='#1f2937', fontweight='bold')
# Legend
dept_labels = ['Comp Sci', 'Electrical', 'Mechanical', 'Physics', 'Chemistry',
'Biology', 'Finance', 'Marketing', 'Management', 'History',
'Literature', 'Philosophy']
ax.legend(wedges_outer, dept_labels, loc='center left', bbox_to_anchor=(1.05, 0.5),
fontsize=9, frameon=True, facecolor='white', edgecolor='#e5e7eb',
labelcolor='#374151', title='Departments', title_fontsize=10)
ax.set_title('University Structure', fontsize=18, color='#1f2937',
fontweight='bold', pad=20)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Part-to-Whole
More Sunburst Chart examples
☕