matplotlib subplots 调整子图间矩的实例

yipeiwu_com5年前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的高阶函数用法实例分析

本文实例讲述了Python的高阶函数用法。分享给大家供大家参考,具体如下: 高阶函数 1.MapReduce MapReduce主要应用于分布式中。 大数据实际上是在15年下半年开始火起...

简单谈谈Python中的闭包

Python中的闭包 前几天又有人留言,关于其中一个闭包和re.sub的使用不太清楚。我在【听图阁-专注于Python设计】搜索了下,发现没有写过闭包相关的东西,所以决定总结一下,完善P...

tensorflow中next_batch的具体使用

本文介绍了tensorflow中next_batch的具体使用,分享给大家,具体如下: 此处给出了几种不同的next_batch方法,该文章只是做出代码片段的解释,以备以后查看:...

Python中read()、readline()和readlines()三者间的区别和用法

前言 众所周知在python中读取文件常用的三种方法:read(),readline(),readlines(),今天看项目是又忘记他们的区别了。以前看书的时候觉得这东西很简单,一眼扫过...

django做form表单的数据验证过程详解

django做form表单的数据验证过程详解

我们之前写的代码都没有对前端input框输入的数据做验证,我们今天来看下,如果做form表单的数据的验证 在views文件做验证 首先用文字描述一下流程 1、在views文件中导入for...