Pie Chart
Energy Sources Mix
Donut chart showing renewable vs non-renewable energy distribution
Output
Python
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(figsize=(10, 8), facecolor='#0f1419')
ax.set_facecolor('#0f1419')
sizes = [28, 22, 18, 15, 10, 7]
labels = ['Natural Gas', 'Coal', 'Nuclear', 'Wind', 'Solar', 'Hydro']
colors = ['#f97316', '#ef4444', '#eab308', '#22c55e', '#facc15', '#0ea5e9']
wedges, texts, autotexts = ax.pie(sizes, labels=None, colors=colors,
autopct='%1.1f%%', startangle=90,
wedgeprops={'linewidth': 2, 'edgecolor': '#0f1419', 'width': 0.5},
pctdistance=0.8)
for autotext in autotexts:
autotext.set_color('#ffffff')
autotext.set_fontsize(10)
autotext.set_fontweight('bold')
centre_circle = plt.Circle((0, 0), 0.50, fc='#0f1419')
ax.add_patch(centre_circle)
ax.text(0, 0, 'Energy\nMix', ha='center', va='center', color='#9ca3af', fontsize=12, fontweight='bold')
ax.legend(wedges, labels, loc='center left', bbox_to_anchor=(1, 0.5),
facecolor='#0f1419', edgecolor='#374151', labelcolor='#d1d5db', fontsize=10)
plt.tight_layout()
Library
Matplotlib
Category
Basic Charts
More Pie Chart examples
☕