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 SDK写一个同步脚本及使用教程

如何使用七牛Python SDK写一个同步脚本及使用教程

七牛云存储的 Python 语言版本 SDK(本文以下称 Python-SDK)是对七牛云存储API协议的一层封装,以提供一套对于 Python 开发者而言简单易用的开发工具。Pytho...

详解Python list 与 NumPy.ndarry 切片之间的对比

详解Python list 与 NumPy.ndarry 切片之间的区别 实例代码: # list 切片返回的是不原数据,对新数据的修改不会影响原数据 In [45]: list1...

Flask web开发处理POST请求实现(登录案例)

本文我们以一个登录例子来说明Flask对 post请求的处理机制。 1、创建应用目录,如 mkdir example cd example 2、在应用目录下创建  ru...

基于python实现名片管理系统

基于python实现名片管理系统

本文实例为大家分享了python实现名片管理系统的具体代码,供大家参考,具体内容如下 主程序: import cards_tools # 无限循环,由用户主动决定什么时候退出 whi...

python交易记录链的实现过程详解

python交易记录链的实现过程详解

接着上篇的内容,这里实现一个交易记录链,废话不多说,先看图: 跟之前的逻辑类似,但也有少许不同,这里多了一个payloadhash,以及对payloadhash和prehash的has...