Stairs Plot
Inventory Levels
Stock levels with reorder points.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
COLORS = {'stock': '#6366F1', 'reorder': '#F59E0B', 'background': '#FFFFFF', 'text': '#1E293B', 'text_muted': '#64748B', 'grid': '#F1F5F9'}
days = np.arange(14)
stock = [100, 95, 88, 80, 72, 65, 120, 115, 108, 100, 92, 85, 78, 70]
edges = np.arange(15)
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
ax.stairs(stock, edges, fill=True, alpha=0.2, facecolor=COLORS['stock'])
ax.stairs(stock, edges, linewidth=2.5, color=COLORS['stock'])
# Reorder point
ax.axhline(75, color=COLORS['reorder'], linewidth=2, linestyle='--')
ax.text(14.2, 75, 'Reorder', fontsize=9, color=COLORS['reorder'], va='center', fontweight='bold')
# Restock annotation
ax.annotate('Restock', (6, 120), xytext=(-20, 15), textcoords='offset points',
fontsize=9, color=COLORS['stock'], fontweight='bold',
arrowprops=dict(arrowstyle='->', color=COLORS['stock'], lw=1.5))
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.yaxis.grid(True, color=COLORS['grid'], linewidth=1, zorder=0)
ax.set_axisbelow(True)
ax.tick_params(axis='both', colors=COLORS['text_muted'], labelsize=9, length=0, pad=8)
ax.set_xlim(0, 14)
ax.set_ylim(50, 140)
ax.set_xlabel('Day', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Units', fontsize=10, color=COLORS['text'], labelpad=10)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Stairs Plot examples
☕