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中几种操作字符串的方法的介绍

#! -*- coding:utf-8 -*- import string s = 'Yes! This is a string' print '原字符串:'...

python psutil库安装教程

python psutil库安装教程

确认本机已安装python环境 查看pip版本 安装psutil 卸载第三方库 总结 以上所述是小编给大家介绍的python psutil库安装教程,希望对大家有所帮助,如果大家...

如何通过雪花算法用Python实现一个简单的发号器

如何通过雪花算法用Python实现一个简单的发号器

实现一个简单的发号器 根据snowflake算法的原理实现一个简单的发号器,产生不重复、自增的id。 1.snowflake算法的简单描述 这里的snowflake算法是用二进制的...

使用FastCGI部署Python的Django应用的教程

作为一个mod_python模块的替代,你可以考虑使用mod_wsgi模块,此模块开发的时间比mod_python的开发时间离现在更近一些,在Django社区已有一些使用。 一个完整的概...

Python封装成可带参数的EXE安装包实例

最近有一个小项目,有如下的需求: 将某几个源码文件夹进行打包,文件夹内有py文件、dll文件、exe文件等各种文件类型 打包生成的安装包,在进行安装的时候,应该能够带有参数,对配置文件进...