Linux 拨号vps windows公众号手机端

python添加子图使用什么函数

lewis 6年前 (2019-03-26) 阅读数 8 #程序编程
文章标签 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()


效果图:

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门