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实现获取命令行输出结果的方法。分享给大家供大家参考,具体如下: Python获取命令行输出结果,并对结果进行过滤找到自己需要的! 这里以获取本机MAC地址和IP...

python基础教程项目四之新闻聚合

《python基础教程》书中的第四个练习,新闻聚合。现在很少见的一类应用,至少我从来没有用过,又叫做Usenet。这个程序的主要功能是用来从指定的来源(这里是Usenet新闻组)收集信息...

详解Python 数据库的Connection、Cursor两大对象

详解Python 数据库的Connection、Cursor两大对象

Python 数据库图解流程 Connection、Cursor比喻 Connection()的参数列表 host,连接的数据库服务器主机名,默认为本地主机(localhost)。u...

Windows10下 python3.7 安装 facenet的教程

Windows10下 python3.7 安装 facenet的教程

前提 1.python环境及tensorflow安装成功 2.Anaconda安装好 ,Anaconda安装步骤 安装步骤 1.下载facenet,https://github.com/...

Python with标签使用方法解析

这篇文章主要介绍了Python with标签使用方法解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 1.在python DTL模板...