Matploblib绘图高级特性

来源:互联网 发布:域名注册怎么弄 编辑:程序博客网 时间:2024/06/06 11:45
fig = plt.figure()#返回figure,可以添加多个axis#fignum的取值:1~numrows*numcols,当前subplot使用subplotax = fig.add_subplot(numrows,numcols,fignum)


fig = plt.figure(1)ax1 = fig.add_subplot(221)#将当前绘图区域划分为2个子区域,并使用第一ax1.plot([1, 2, 3], [1, 2, 3])ax2 = fig.add_subplot(222)#使用第二个ax2.plot([0, 1, 2], [0, 2, 1]);    ax3 = fig.add_subplot(223)#使用第三个ax3.plot([1, 2, 3], [3, 2, 1]);ax4 = fig.add_subplot(224)#使用第四个ax4.plot([0, 1, 2], [0, 2, 1]);plt.show()  

fig1 = plt.figure()ax1 = fig1.add_subplot(111)ax1.plot([1, 2, 3], [1, 2, 3]);fig2 = plt.figure()ax2 = fig2.add_subplot(111)ax2.plot([1, 2, 3], [3, 2, 1]);plt.show()#同时显示多个图片


原创粉丝点击