matplotlib subplots 调整子图间矩的实例

yipeiwu_com6年前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中的logger模块全面讲解

logging模块介绍 Python的logging模块提供了通用的日志系统,熟练使用logging模块可以方便开发者开发第三方模块或者是自己的Python应用。同样这个模块提供不同的日...

PyQt5固定窗口大小的方法

PyQt5固定窗口大小的方法

直接以数值固定大小 根据屏幕大小固定大小 禁止最大化按钮 MainWindow.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint...

用Python输出一个杨辉三角的例子

关于杨辉三角是什么东西,右转维基百科:杨辉三角 稍微看一下直观一点的图:复制代码 代码如下:        1       1 1      1 2 1     1 3 3 1    1...

python使用PyFetion来发送短信的例子

通过PyFetion可以很方便的使用python来用飞信发送短信,下面贴出代码:复制代码 代码如下:from fetion import *import osdef SendSMS(sm...

python 中split 和 strip的实例详解

 python 中split 和 strip的实例详解 一直以来都分不清楚strip和split的功能,实际上strip是删除的意思;而split则是分割的意思。 python...