扫描二维码下载沐宇APP

沐宇

微信扫码使用沐宇小程序

沐宇

python添加子图使用什么函数

扬州沐宇科技
2021-01-26 18:22:58
python

python添加子图使用什么函数

python中使用matplotlib模块的add_subplot函数添加子图,具体方法如下:

from matplotlib import pyplot as plt #导入matplotlib模块


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()


效果图:

python添加子图使用什么函数

扫码添加客服微信