Subplots

plt.subplots(nrows, ncols) creates a grid of charts in a single figure, returning the figure and an array of Axes. The sharex and sharey parameters share scales to make comparison easier, and constrained_layout=True prevents text from overlapping.

Example

fig, axes = plt.subplots(1, 2, sharey=True, constrained_layout=True)

Related concepts

The whole glossary