Bar Chart

Bullet Chart Light

Bullet chart with light background

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

metrics = ['Sales', 'Revenue', 'Profit', 'Growth', 'Retention']
actuals = [78, 85, 62, 91, 74]
targets = [75, 80, 70, 85, 80]

fig, axes = plt.subplots(5, 1, figsize=(10, 7), facecolor='#ffffff')

for i, (ax, metric, actual, target) in enumerate(zip(axes, metrics, actuals, targets)):
    ax.set_facecolor('#ffffff')
    
    ax.barh(0, 100, height=0.7, color='#f3f4f6')
    ax.barh(0, 75, height=0.7, color='#e5e7eb')
    ax.barh(0, 50, height=0.7, color='#d1d5db')
    
    color = '#22c55e' if actual >= target else '#ef4444'
    ax.barh(0, actual, height=0.35, color=color)
    
    ax.plot([target, target], [-0.3, 0.3], color='#1f2937', linewidth=3)
    
    ax.text(actual + 2, 0, f'{actual}%', va='center', color='#374151', fontsize=9, fontweight='500')
    
    ax.set_xlim(0, 105)
    ax.set_ylim(-0.5, 0.5)
    ax.set_yticks([0])
    ax.set_yticklabels([metric], color='#374151', fontsize=10)
    
    for spine in ax.spines.values():
        spine.set_visible(False)
    
    if i < 4:
        ax.set_xticks([])
    else:
        ax.tick_params(axis='x', colors='#6b7280', labelsize=8)

axes[0].set_title('KPI Dashboard', 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