According to the documentation of matplotlib.pyplot.subplot
, one needs to either use a three-digit integer (like 234) or three integers (like 2, 3, 4) to decide the position of the subplot.
import matplotlib.pyplot as plt
# Create a 3*3 arrangement and draw subplots with indices 1 and 2
fig1 = plt.subplot(331)
fig2 = plt.subplot(332)
plt.show()
This gives:

The white space in the figure above shows that we have the blueprint to plot other subplots in the 3*3 arrangement, but we haven't explicitly told matplotlib to draw them. Indexing starts from 1 and refers to the top-left subplot in the figure.
This can be utilised to create subplots with different sizes e.g.
fig3 = plt.subplot(331)
fig4 = plt.subplot(122)
plt.show()
gives:

Another way to get a m * n subplots arrangement is to use the arguments nrows and ncols of matplotlib.pyplot.subplots
to get desired numbers of rows and columns in the plot:
fig, ax = plt.subplots(nrows=3, ncols=1)
which gives:

If you are just getting started with matplotlib, you might wonder why plt.subplot
returns one object and plt.subplots
returns two. To understand that, please check this answer and to learn more about matplotlib, please check the matplotlib documentation.