话不多说,实例代码给大家贴一下
from matplotlib import pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(231)
ax2 = fig.add_subplot(232)
ax3 = fig.add_subplot(233)
ax4 = fig.add_subplot(234)
ax5 = fig.add_subplot(235)
ax6 = fig.add_subplot(236)
plt.grid(True)
plt.show()
add_subplot 参数说明:
返回axes实例
参数1:子位图总行数
参数2:子位图总列数
参数3:子位图所在位置