Pyplot is the high-level, MATLAB-style interface to Matplotlib. It’s the submodule conventionally imported as plt:
import matplotlib.pyplot as pltPyplot provides functions like plt.plot(x, y), plt.scatter(x, y), plt.title(...), plt.show() that work on an implicit current figure and axes. You don’t have to create the figure or axes objects yourself. Pyplot maintains them in the background and applies your commands to whichever one is current. Convenient for quick scripts and interactive exploration.
The implicit-current-figure model breaks down as soon as you want explicit control over multiple plots, or you want to build a figure from a function that doesn’t know about the current state. For that, use the object-oriented style: explicitly create a figure and axes and call methods on them.
fig, ax = plt.subplots() # explicit figure + axes
ax.plot(x, y)
ax.set_title('My plot')
plt.show()The convention in production code and library code is the object-oriented style. The Pyplot one-liner style is fine for notebook exploration and very small scripts.
The core types, Figure and Axes, are defined elsewhere in Matplotlib. Pyplot is mostly a convenience layer that creates them on demand and dispatches function calls to them.