Bar Chart

Dumbbell Chart Light

Before/after comparison with light theme

Output
Dumbbell Chart Light
Python
import matplotlib.pyplot as plt
import numpy as np

categories = ['Metric A', 'Metric B', 'Metric C', 'Metric D', 'Metric E', 'Metric F']
before = [45, 62, 38, 55, 48, 70]
after = [68, 75, 52, 71, 65, 82]

fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

y_pos = np.arange(len(categories))

for i, (b, a) in enumerate(zip(before, after)):
    ax.plot([b, a], [i, i], color='#e5e7eb', linewidth=3, zorder=1)

ax.scatter(before, y_pos, color='#9ca3af', s=120, zorder=2, label='Before', edgecolor='white', linewidth=2)
ax.scatter(after, y_pos, color='#6366f1', s=120, zorder=2, label='After', edgecolor='white', linewidth=2)

for i, (b, a) in enumerate(zip(before, after)):
    change = a - b
    ax.text(a + 3, i, f'+{change}', va='center', color='#22c55e', fontsize=9, fontweight='bold')

ax.set_yticks(y_pos)
ax.set_yticklabels(categories, color='#374151', fontsize=10)
ax.set_xlabel('Score', color='#6b7280', fontsize=11)
ax.set_xlim(30, 100)

ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#e5e7eb')
ax.spines['bottom'].set_color('#e5e7eb')
ax.tick_params(axis='both', colors='#6b7280', labelsize=9)
ax.xaxis.grid(True, color='#f3f4f6', linewidth=1)
ax.set_axisbelow(True)

ax.legend(loc='lower right', frameon=False, labelcolor='#374151', fontsize=9)
ax.set_title('Improvement Analysis', color='#1f2937', fontsize=14, fontweight='bold', pad=15)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support