Polar Chart

Market Sector Allocation

Investment portfolio distribution with vibrant segments

Output
Market Sector Allocation
Python
import matplotlib.pyplot as plt
import numpy as np

sectors = ['Tech', 'Finance', 'Healthcare', 'Energy', 'Consumer', 'Industrial', 'Materials', 'Utilities']
allocation = [28, 18, 15, 12, 10, 8, 5, 4]

angles = np.linspace(0, 2 * np.pi, len(sectors), endpoint=False)
width = 2 * np.pi / len(sectors) * 0.85

fig, ax = plt.subplots(figsize=(10, 10), subplot_kw=dict(polar=True), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

colors = ['#F5276C', '#4927F5', '#6CF527', '#F5B027', '#27D3F5', '#F54927', '#27F5B0', '#F527B0']
bars = ax.bar(angles, allocation, width=width, bottom=5, alpha=0.8)
for bar, color in zip(bars, colors):
    bar.set_facecolor(color)
    bar.set_edgecolor('white')
    bar.set_linewidth(1.5)

ax.set_xticks(angles)
ax.set_xticklabels(sectors, fontsize=10, color='#1f2937', fontweight='500')
ax.set_ylim(0, 35)
ax.set_yticks([10, 20, 30])
ax.set_yticklabels(['10%', '20%', '30%'], fontsize=9, color='#374151')
ax.spines['polar'].set_color('#e5e7eb')
ax.grid(color='#e5e7eb', linewidth=0.8)
ax.set_title('Market Sector Allocation', fontsize=16, color='#1f2937', fontweight='bold', pad=20, y=1.08)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Part-to-Whole

Did this help you?

Support PyLucid to keep it free & growing

Support