Final Visualisation and Report Export
Build a multi-panel Matplotlib figure with annotated charts, export to PNG and PDF, and write a structured summary to a markdown file.
The Final Deliverable
The last stage of the capstone turns computed KPIs into a polished, shareable deliverable: a multi-panel Matplotlib figure with annotated charts and a structured markdown report with embedded visualisation references. This is what stakeholders actually receive — clear visuals and a narrative summary. Good visualisation transforms numbers into insights; good report structure makes those insights actionable. This lesson covers figure architecture, annotation, export to PNG/PDF, and structured markdown generation.
Setting Up the Multi-Panel Figure
Use plt.subplots() with figsize and gridspec_kw to create a figure with panels of different sizes. A common executive report layout: a wide trend chart on top, a retention heatmap and region bar chart on the bottom row. Set a consistent style upfront with plt.style.use('seaborn-v0_8-whitegrid') to get clean, professional-looking charts without manual formatting of each element.
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
plt.style.use('seaborn-v0_8-whitegrid')
# 2x2 layout with custom row heights
fig = plt.figure(figsize=(16, 12))
gs = gridspec.GridSpec(2, 2,
height_ratios=[1, 1.2],
hspace=0.4, wspace=0.35)
ax_trend = fig.add_subplot(gs[0, :]) # full width top row
ax_heatmap = fig.add_subplot(gs[1, 0]) # bottom left
ax_bar = fig.add_subplot(gs[1, 1]) # bottom right
print('Figure with 3 panels created.')All lessons in this course
- Project Setup and Data Ingestion
- Data Cleaning and Feature Engineering
- Analysis and KPI Computation
- Final Visualisation and Report Export