Phase 3: Data Visualization · ~25 minutes · Python · matplotlib
Figures and Axes, the Object-Oriented Way
plt.plot() doesn't ask which figure you meant. It draws on whichever one happens to be 'current' — and forgetting that is the single most common way a second plot silently ruins the first.
Hiring signal: Reaches for fig, ax = plt.subplots() by default, specifically because it names which axes every draw call targets instead of relying on implicit global state
What you will learn
- Build a plot using the object-oriented fig, ax = plt.subplots() pattern
- Explain what pyplot's global 'current figure' state actually is
- Diagnose why a second plt.plot() call silently drew onto the first figure instead of a new one
- Extend a single plot into multiple side-by-side subplots using the OO pattern
Introduction
Type: Learn Languages: Python, matplotlib Prerequisites: Phase 02 (NumPy for Data) Time: ~25 minutes
Objective
Learning objectives
- Build a plot using the object-oriented
fig, ax = plt.subplots() pattern - Explain what pyplot's global "current figure" state actually is
- Diagnose why a second
plt.plot() call silently drew onto the first figure instead of a new one - Extend a single plot into multiple side-by-side subplots using the OO pattern
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers The Problem, The Concept, Build, Key Terms & Next — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy