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

相关文章

分享vim python缩进等一些配置

VIM python下的一些关于缩进的设置: 第一步: 打开终端,在终端上输入vim ~/.vimrc,回车。 第二步: 添加下面的文段: set filetype=p...

selenium2.0中常用的python函数汇总

本文总结分析了selenium2.0中常用的python函数。分享给大家供大家参考,具体如下: 新建实例driver = webdriver.Firefox() 此处定位均使用的百度首...

Ubuntu下使用python读取doc和docx文档的内容方法

读取docx文档 使用的包是python-docx 1. 安装python-docx包 sudo pip install python-docx 2. 使用python-docx...

Python中property属性实例解析

本文主要讲述的是对Python中property属性(特性)的理解,具体如下。 定义及作用: 在property类中,有三个成员方法和三个装饰器函数。 三个成员方法分别是:fget、f...

Python3基础之基本数据类型概述

本文针对Python3中基本数据类型进行实例介绍,这些对于Python初学者而言是必须掌握的知识,具体内容如下: 首先,Python中的变量不需要声明。每个变量在使用前都必须赋值,变量赋...