- Compare metrics side-by-side within a single figure
- Tell a complete story without switching charts
- Dashboard-style layouts for executive reports
- Avoid clutter from multi-series single charts
fig, axes = plt.subplots(rows, cols, figsize=(w,h))- Access individual panels:
axes[0, 1] sharex=True / sharey=True for aligned scales- Flatten:
axes.flatten() for loop iteration
gs = fig.add_gridspec(2, 3) for flexible grids- Span rows/cols:
fig.add_subplot(gs[0, :]) - Mix wide overview charts with narrow detail panels
- Set relative sizes with
height_ratios, width_ratios
- Shared x-axis aligns time series across panels
- Shared y-axis enables direct value comparison
- Remove redundant tick labels on inner subplots
ax.set_visible(False) to hide empty panels
plt.tight_layout() — prevent label overlapfig.suptitle() — overall figure titleplt.subplots_adjust(hspace, wspace) for spacing- Save at 300 DPI for presentation-quality output
- Part A: Regional performance 2×2 subplot dashboard
- Part B: Product performance vertical 3-panel dashboard
- Apply shared axes and suptitle across all panels
- Export at 300 DPI for a boardroom-ready layout