How to plot in multiple subplots

I am a little confused about how this code works:

fig, axes = plt.subplots(nrows=2, ncols=2)
plt.show()

How does the fig, axes work in this case? What does it do?

Also why wouldn’t this work to do the same thing:

fig = plt.figure()
axes = fig.subplots(nrows=2, ncols=2)

11 Answers
11

Leave a Comment