Axes (Matplotlib)
An Axes is a single plot within a Figure — one set of x and y axes with its own data, ticks, labels, and title. Most plotting methods like plot, scatter, and bar are called on an Axes object.
Matplotlib
Despite the confusing name, an Axes is not an axis line; it is the whole rectangular plotting region. A Figure can contain many Axes (a grid of subplots), and each Axes is an independent chart you draw into with ax.plot(), ax.scatter(), ax.bar(), and so on.
The Axes is where most configuration happens in the object-oriented style: ax.set_title(), ax.set_xlabel(), ax.set_xlim(), ax.legend(), and ax.grid() all customize that one plot. This is clearer than the pyplot shortcuts when a Figure has several panels, because the target is explicit.
Inside an Axes live the two (or three, in 3-D) Axis objects that manage the individual x and y scales, ticks, and tick labels — so Axes contains Axis, which is a frequent source of naming confusion.
Syntax
fig, ax = plt.subplots(); ax.plot(x, y)Examples
Python
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
print(type(ax).__name__)Output:
Axes