Skip to main content
Albero Academy

Figure & Axes

The anatomy of a Matplotlib plot — Figure, Axes, and the parts of a chart.

Foundations10 min

Understanding Matplotlib's object model is the key that unlocks everything else. A plot is a hierarchy: a Figure is the whole canvas, and it contains one or more Axes — each a single plot with its own data, ticks and labels.

Figure vs Axes

ObjectWhat it is
FigureThe whole window/page — the outer container
AxesA single plot inside the figure (not the x/y axis!)
AxisThe x or y number line on an Axes
ArtistsEverything drawn: lines, text, ticks, legend

Creating them

fig and ax
fig, ax = plt.subplots() # a Figure with one Axes
ax.plot([1, 2, 3], [4, 5, 6]) # draw on the Axes
ax.set_title("My plot")
ax.set_xlabel("x"); ax.set_ylabel("y")
plt.show()

Key takeaways

  1. 01A Figure is the whole canvas; an Axes is a single plot inside it.
  2. 02An "Axes" is a subplot/data area — NOT the x/y axis (that's an "Axis").
  3. 03One Figure can contain many Axes (a grid of subplots).
  4. 04fig, ax = plt.subplots() creates a Figure with one Axes to draw on.

Finished this chapter?

Mark it complete to track your progress through Matplotlib.