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 JSON编解码方式原理详解

Python JSON编解码方式原理详解

这篇文章主要介绍了Python JSON编解码方式原理详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 概念 JSON(JavaS...

Python实现将json文件中向量写入Excel的方法

本文实例讲述了Python实现将json文件中向量写入Excel的方法。分享给大家供大家参考,具体如下: 有一个需要是将已经向量化的页面的数据中的向量写入Excel中用于展示,工作很简单...

Python不规范的日期字符串处理类

我分析了形如19920203、199203、1992.02.03、1992.02、1992-02-03、1992-02、920203时间格式特征,列出了正则表达式如下:复制代码 代码如下...

PyCharm 常用快捷键和设置方法

PyCharm 常用快捷键和设置方法

pycharm常用快捷键 1、编辑(Editing) Ctrl + Space基本的代码完成(类、方法、属性) Ctrl + Alt + Space快速导入任意类 Ctrl + Shif...

Windows下搭建python开发环境详细步骤

Windows下搭建python开发环境详细步骤

本文为大家分享了Windows下搭建python开发环境详细步骤,供大家参考,具体内容如下 1.搭建Java环境 (1)直接从官网下载相应版本的JDK或者JRE并点击安装就可以 (2)J...