Stem Plot

Event Timeline Stem

Alternating stems for event visualization.

Output
Event Timeline Stem
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'events': ['#6366F1', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6'],
    'background': '#FFFFFF',
    'text': '#1E293B',
    'text_muted': '#64748B',
}

events = ['Launch', 'Update 1.0', 'Major Fix', 'Update 2.0', 'Milestone']
dates = [1, 3, 4, 7, 10]
importance = [0.8, 0.5, 0.3, 0.9, 1.0]

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

ax.axhline(0, color=COLORS['text'], linewidth=2, zorder=1)

for i, (date, event, imp, color) in enumerate(zip(dates, events, importance, COLORS['events'])):
    direction = 1 if i % 2 == 0 else -1
    height = imp * direction * 0.8
    
    ax.plot([date, date], [0, height], color=color, linewidth=3, zorder=2)
    ax.scatter(date, height, s=200, c=color, alpha=0.2, zorder=3)
    ax.scatter(date, height, s=100, c=color, edgecolors='white', linewidths=2, zorder=4)
    
    offset = 0.15 if direction > 0 else -0.15
    va = 'bottom' if direction > 0 else 'top'
    ax.text(date, height + offset, event, ha='center', va=va, fontsize=9,
            fontweight='bold', color=COLORS['text'])

ax.set_xlim(0, 11)
ax.set_ylim(-1.2, 1.2)
ax.axis('off')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support