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设计】。

相关文章

pycharm执行python时,填写参数的方法

pycharm执行python时,填写参数的方法

1、按快捷键:alt+shift+F10调出运行窗口,之后选择Edit Configurations或者按0 2、输入参数,点击运行 以上这篇pycharm执行python时,填写参...

django和vue实现数据交互的方法

我使用的是jQuery的ajax与django进行数据交互,遇到的问题是django的csrf 传输数据的方法如下: $(function() { $.ajax({ ur...

Python MySQLdb模块连接操作mysql数据库实例

mysql是一个优秀的开源数据库,它现在的应用非常的广泛,因此很有必要简单的介绍一下用python操作mysql数据库的方法。python操作数据库需要安装一个第三方的模块,在http:...

采用python实现简单QQ单用户机器人的方法

采用python实现简单QQ单用户机器人的方法如下: 一、首先我们查看一下关于3GQQ的相关协议:     对此,打开一个支持WAP的浏览器,可以使用Fir...

python连接池实现示例程序

复制代码 代码如下:import socketimport Queueimport threading def worker():    while Tru...