用法
通常使用 fig, ax = plt.subplots()
可以创建多张子图,而plt.subplot() 通常用来区别各个子图
# create a subplot with 2 rows and 1 columns
fig, ax = plt.subplots(2,1)
fig = plt.figure() # create the canvas for plotting
ax1 = plt.subplot(2,1,1)
# (2,1,1) indicates total number of rows, columns, and figure number respectively
ax2 = plt.subplot(2,1,2)
ax3 = plt.subplot(2,1,3)
fig, axes = plt.subplots(nrows=2, ncols=3)
# first you have to make the figure
fig = plt.figure(1)
# now you have to create each subplot individually
ax1 = plt.subplot(231)
ax2 = plt.subplot(232)
ax3 = plt.subplot(233)
ax4 = plt.subplot(234)
ax5 = plt.subplot(235)
ax6 = plt.subplot(236)