Bar Chart

Multi-Metric Grid

Side-by-side bar charts for metric comparison.

Output
Multi-Metric Grid
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'bar': '#6366F1',
    'background': '#FFFFFF',
    'text': '#1E293B',
    'text_muted': '#64748B',
    'grid': '#F1F5F9',
}

metrics = ['Metric 1', 'Metric 2', 'Metric 3', 'Metric 4']
products = ['A', 'B', 'C']
data = [
    [85, 72, 90],
    [60, 88, 75],
    [95, 65, 80],
    [70, 78, 85],
]

fig, axes = plt.subplots(1, 4, figsize=(12, 4), dpi=100, sharey=True)
fig.patch.set_facecolor(COLORS['background'])

for ax, metric, vals in zip(axes, metrics, data):
    ax.set_facecolor(COLORS['background'])
    
    for i, v in enumerate(vals):
        ax.bar(i, v, width=0.6, color=COLORS['bar'], alpha=0.85,
               edgecolor='white', linewidth=1.5)
        ax.text(i, v + 3, str(v), ha='center', fontsize=9, 
                fontweight='bold', color=COLORS['text'])
    
    ax.set_title(metric, fontsize=10, fontweight='bold', color=COLORS['text'], pad=10)
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    ax.spines['left'].set_color(COLORS['grid'])
    ax.spines['bottom'].set_color(COLORS['grid'])
    
    ax.set_xticks(range(len(products)))
    ax.set_xticklabels(products)
    ax.set_ylim(0, 110)
    ax.tick_params(colors=COLORS['text_muted'], labelsize=9, length=0, pad=5)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support