Capstone: Build a Dashboard
Matplotlib is a Python library for creating charts and visualizations — and in this capstone you'll combine everything you've learned into a single multi-panel dashboard that tells a complete data story.
Learn Capstone: Build a Dashboard in our free Matplotlib course — a beginner-friendly interactive lesson with worked examples, a practice exercise and a…
Part of the free Matplotlib course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
You'll lay out four coordinated charts in one figure, style them consistently, add a super-title, and export the finished result as a high-resolution image.
A dashboard is just one Figure divided into a grid of Axes . We'll use a 2×2 grid, so we get four panels to fill. plt.subplots(2, 2) returns the figure plus a 2D array of axes we can index with axs[row, col] .
What you'll see: a single window split into four empty boxes arranged 2-by-2. Each box has its own title, and a bold super-title sits across the very top. This is the skeleton we'll now fill in.
Now we draw a different chart type into each Axes using the object-oriented interface — ax.plot , ax.bar , ax.pie , and ax.scatter . Each panel keeps its own labels.
What you'll see: a polished four-panel dashboard. Top-left, a blue line with circle markers climbs across the six months. Top-right, four green bars compare regions. Bottom-left, a pie split into four labelled wedges with percentages. Bottom-right, orange dots scatter price against units. The bold title ties it all together.
Finish by applying a consistent style with plt.style.use and saving the figure to disk with fig.savefig . Use bbox_inches="tight" to trim whitespace and a higher dpi for crisp output.
What you'll see: a clean two-panel figure on a soft white-grid theme. The left panel overlays revenue and cost lines with a legend; the right shows green profit bars. A file dashboard.png is written to your folder at 150 DPI with the margins trimmed tight.
Replace each ___ to finish this two-panel dashboard.
You forgot fig.tight_layout() . Call it after all panels are drawn, or pass constrained_layout=True to plt.subplots() .
❌ TypeError: 'AxesSubplot' object is not subscriptable
With a single row or column, axs is 1D — index it as axs[0] , not axs[0, 0] . The 2D form only works for a true grid like subplots(2, 2) .
Call fig.savefig(...) before plt.show() — showing the window clears the figure.
Build a 1×3 dashboard with a line, a bar, and a pie panel, then export it.
Course complete — you can now build full data dashboards!
From your first three-line chart to a styled, exported, multi-panel dashboard, you've covered the entire Matplotlib workflow: figures and axes, every core chart type, styling, annotations, dates, pandas integration, heatmaps, 3D, and global customization.
🚀 Keep going: rebuild one of these dashboards with your own real data — a budget, a fitness log, or a project's metrics. That's how the skills truly stick.
Practice quiz
What does plt.subplots(2, 2) return?
- The figure plus a 2D array of Axes
- Only a figure
- A single Axes
- A list of figures
Answer: The figure plus a 2D array of Axes. It returns (fig, axs) where axs is a 2x2 array of Axes you index as axs[row, col].
How do you index the top-right panel of a 2x2 grid?