Bar Chart

Sparkline Bar Chart

Compact daily trend visualization with max highlight.

Output
Sparkline Bar Chart
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'bars': '#6366F1',
    'highlight': '#10B981',
    'background': '#FFFFFF',
    'text': '#1E293B',
    'text_muted': '#64748B',
}

# Daily data for one month
np.random.seed(42)
days = np.arange(1, 31)
values = 50 + np.cumsum(np.random.randn(30) * 3)
max_idx = np.argmax(values)

fig, ax = plt.subplots(figsize=(12, 3), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])

colors = [COLORS['highlight'] if i == max_idx else COLORS['bars'] for i in range(len(values))]
ax.bar(days, values, width=0.8, color=colors, alpha=0.85, edgecolor='white', linewidth=0.5)

# Highlight max
ax.annotate(f'Max: {values[max_idx]:.0f}', (days[max_idx], values[max_idx]),
            xytext=(0, 10), textcoords='offset points', ha='center',
            fontsize=9, fontweight='bold', color=COLORS['highlight'])

ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['bottom'].set_visible(False)
ax.tick_params(left=False, labelleft=False, bottom=False, labelbottom=False)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support