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 set常用操作函数集锦

定义 set是一个无序且不重复的元素集合。 集合对象是一组无序排列的可哈希的值,集合成员可以做字典中的键。集合支持用in和not in操作符检查成员,由len()内建函数得到集合的基数(...

python命令行解析之parse_known_args()函数和parse_args()使用区别介绍

在python中,命令行解析的很好用, 首先导入命令行解析模块 import argparse import sys 然后创建对象 parse=argparse.ArgumentP...

Window 64位下python3.6.2环境搭建图文教程

Window 64位下python3.6.2环境搭建图文教程

python3.6.2环境安装配置图文教程,具体如下 一、需要下载的软件 》python3.6.2.exe (也可以选择更新的版本) ---- -网址 》Anaconda3-4.4.0...

flask框架json数据的拿取和返回操作示例

本文实例讲述了flask框架json数据的拿取和返回操作。分享给大家供大家参考,具体如下: json数据结构:以套票票网站的城市数据为例,拿到数据莫慌, 1 先分析数据结构,有几个大的字...

在java中如何定义一个抽象属性示例详解

前言 本文主要给大家介绍的是在java中定义一个抽象属性的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍: Abstract关键字通常被用于类和方法,用来把某些行...