matplotlib.pyplot中add_subplot方法参数的含义

时间:2024-03-27 18:52:28

ax = fig.add_subplot(349)
参数349的意思是:将画布分割成3行4列,图像画在从左到右从上到下的第9块
那第十块怎么办,3410是不行的,可以用另一种方式(3,4,10)。
fig = plt.figure()
ax = fig.add_subplot(2,1,1)
ax.plot(x,y)
ax = fig.add_subplot(2,2,3)#重新开始分区,并非从上一处开始
ax.plot(x,y)
plt.show()

matplotlib.pyplot中add_subplot方法参数的含义