Sunburst Chart

Corporate Budget Hierarchy

Light-themed sunburst chart showing corporate budget allocation from company level to department to specific cost centers.

Output
Corporate Budget Hierarchy
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 - Major divisions
div_sizes = [40, 30, 20, 10]
div_labels = ['Technology', 'Commercial', 'Operations', 'Corporate']
div_colors = ['#276CF5', '#6CF527', '#F5B027', '#5314E6']

# Outer ring - Cost centers
cost_sizes = [15, 12, 8, 5, 12, 10, 8, 10, 6, 4, 5, 5]
cost_colors = ['#276CF5', '#4A8CFF', '#6BA3FF', '#8CBAFF',
               '#6CF527', '#8FFF5C', '#B2FF8C',
               '#F5B027', '#FFCC5C', '#FFD98C',
               '#5314E6', '#7B4DFF']

wedges_outer, _ = ax.pie(cost_sizes, radius=1, colors=cost_colors,
       wedgeprops=dict(width=0.3, edgecolor='white', linewidth=2))

wedges_inner, _ = ax.pie(div_sizes, radius=0.7, colors=div_colors,
       wedgeprops=dict(width=0.3, edgecolor='white', linewidth=2))

# Add division labels
for i, (wedge, label) in enumerate(zip(wedges_inner, div_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, 'FY2024\n$48M', ha='center', va='center',
        fontsize=14, color='#1f2937', fontweight='bold')

# Legend
cost_labels = ['Engineering', 'Infrastructure', 'Security', 'Data',
               'Sales', 'Marketing', 'Support', 'Supply Chain', 'Facilities', 
               'Legal', 'HR', 'Finance']
ax.legend(wedges_outer, cost_labels, loc='center left', bbox_to_anchor=(1.05, 0.5),
          fontsize=9, frameon=True, facecolor='white', edgecolor='#e5e7eb',
          labelcolor='#374151', title='Cost Centers', title_fontsize=10)

ax.set_title('Annual Budget Allocation', fontsize=18, color='#1f2937',
             fontweight='bold', pad=20)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Part-to-Whole

Did this help you?

Support PyLucid to keep it free & growing

Support