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将控制台输出保存至文件的方法

很多时候在Linux系统下运行python程序时,控制台会输出一些有用的信息。为了方便保存这些信息,有时需要对这些信息进行保存。这里介绍几种将控制台输出保存到文件中的方式: 1 重定向标...

利用python将图片转换成excel文档格式

前言 本文主要介绍了关于利用python将图片转换成excel文档的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍吧。 实现步骤 读取图像,获取图像每个像素...

python中的一些类型转换函数小结

函数               &...

Python 解决OPEN读文件报错 ,路径以及r的问题

Python 中 ‘unicodeescape' codec can't decode bytes in position XXX: trun错误解决方案 背景描述 今天在运用Pytho...

关于python多重赋值的小问题

前言 今天无意中发现在python中的一个多重赋值的小问题,自己一开始是比较简单化的理解了这个多重赋值操作的概念,所以导致在一道实现斐波那契数列的代码中,发现了自己的问题,顺便记录下吧,...