matplotlib subplots 调整子图间矩的实例

yipeiwu_com5年前Python基础

在matplotlib中,用subplots画子图时,有时候需要调整子图间矩,包括子图与边框的间矩,子图间上下间矩,子图间左右间矩,可以使用fig.tight_layout()函数:

Help on method tight_layout in module matplotlib.figure:

tight_layout(renderer=None, pad=1.08, h_pad=None, w_pad=None, rect=None) method of matplotlib.figure.Figure instance
  Adjust subplot parameters to give specified padding.
  
  Parameters:
  
   *pad* : float
    padding between the figure edge and the edges of subplots,
    as a fraction of the font-size.
   *h_pad*, *w_pad* : float
    padding (height/width) between edges of adjacent subplots.
    Defaults to `pad_inches`.
   *rect* : if rect is given, it is interpreted as a rectangle
    (left, bottom, right, top) in the normalized figure
    coordinate that the whole subplots area (including
    labels) will fit into. Default is (0, 0, 1, 1).

以上这篇matplotlib subplots 调整子图间矩的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

python数字图像处理之骨架提取与分水岭算法

python数字图像处理之骨架提取与分水岭算法

骨架提取与分水岭算法也属于形态学处理范畴,都放在morphology子模块内。 1、骨架提取 骨架提取,也叫二值图像细化。这种算法能将一个连通区域细化成一个像素的宽度,用于特征提取和目标...

Django添加favicon.ico图标的示例代码

所谓favicon,即Favorites Icon的缩写,让浏览器的收藏夹中除显示相应的标题外,还以图标的方式区别不同的网站。 默认情况下,浏览器访问一个网站的时候,同时还会向服务器请求...

Python socket聊天脚本代码实例

这篇文章主要介绍了Python socket聊天脚本代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 没有前端,多开了一条线程用...

Python实现的下载8000首儿歌的代码分享

下载8000首儿歌的python的代码: 复制代码 代码如下: #-*- coding: UTF-8 -*- from pyquery import PyQuery as py from...

Python3 把一个列表按指定数目分成多个列表的方式

如果我们需要将一个列表按指定数目分成多个列表:比如[1,2,3,4,5,6,7,8,9,10]分成[1,2,3][4,5,6][7,8,9][10],我们可以建立一个列表分割的函数spl...