官方文档:
def subplots_adjust(self, left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)
left = 0.125 # the left side of the subplots of the figure
right = 0.9 # the right side of the subplots of the figure
bottom = 0.1 # the bottom of the subplots of the figure
top = 0.9 # the top of the subplots of the figure
wspace = 0.2 # the amount of width reserved for space between subplots,
# expressed as a fraction of the average axis width
hspace = 0.2 # the amount of height reserved for space between subplots,
# expressed as a fraction of the average axis height
参数含义:
left, right, bottom, top:子图所在区域的边界。
当值大于1.0的时候子图会超出figure的边界从而显示不全;值不大于1.0的时候,子图会自动分布在一个矩形区域(下图灰色部分)。
要保证left < right, bottom < top,否则会报错。
如下图:
wspace, hspace:子图之间的横向和纵向间距。
无论如何所有子图都不会超出left, right, top, bottom所围区域。子图的长宽比不变,而是按比例缩小,所以调整横向间距也可能影响纵向间距,反之亦然。
如下图: