码迷,mamicode.com
首页 > 其他好文 > 详细

matplotlib.pyplot.subplots_adjust

时间:2020-02-01 12:26:35      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:mamicode   布局   port   参数   one   log   code   image   none   

调整子图布局,调用格式如下:

subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)

参数

 有六个可选参数来控制子图布局。值均为0~1之间。其中left、bottom、right、top围成的区域就是子图的区域。wspace、hspace分别表示子图之间左右、上下的间距。实际的默认值由matplotlibrc文件控制的。

简单示例

import matplotlib.pyplot as plt
 
x=[1,2,3]
y=[4,5,6]
fig, axs = plt.subplots(2, 2)
axs[0, 0].plot(x,y)
axs[0, 1].plot(x,y)
axs[1, 0].plot(x,y)
axs[1, 1].plot(x,y)
 
plt.subplots_adjust(left=0.1, bottom=0.5, right=0.8, wspace=0.01)
 
plt.show()

运行结果如下:

技术图片

 

matplotlib.pyplot.subplots_adjust

标签:mamicode   布局   port   参数   one   log   code   image   none   

原文地址:https://www.cnblogs.com/SupremeBoy/p/12248034.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!