Lesson 34 of 60
pythonSubplots, Grids, and Layouts
20 minutes
Course progress57%
Subplots and Layout Management
Often you need multiple plots in a single figure.
Simple 2×2 grid of subplots
fig, axs = plt.subplots(2, 2, figsize=(10,8))
axs[0,0].plot(x, y)
axs[0,0].set_title()
axs[,].scatter(x, y)
axs[,].set_title()
axs[,].hist(y, bins=)
axs[,].set_title()
axs[,].boxplot(y)
axs[,].set_title()
plt.tight_layout()
plt.show()