figure函数--Matplotlib
figure函数–Matplotlib
函数功能:
Create a new figure, or activate an existing figure.
创建一个新图形或者激活一个现有图形
函数语法:
figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=<class ‘matplotlib.figure.Figure’>, clear=False, **kwargs)
函数参数:
num: int or str, optional
A unique identifier for the figure.
If a figure with that identifier already exists, this figure is made active and returned. An integer refers to the Figure.number attribute, a string refers to the figure label.
图形标识符: 可选参数,整数或者字符串,画布的唯一标识。
如果具有该标识符的画布已经存在,则将该画布激活并返回。整数表示 Figure.number属性,字符串表示图形标签。
If there is no figure with the identifier or num is not given, a new figure is created, made active and returned. If num is an int, it will be used for the Figure.number attribute, otherwise, an auto-generated integer value is used (starting at 1 and incremented for each new figure). If num is a string, the figure label and the window title is set to this value.
若该标识符无对应图形或者参数num没有指定,会创建一个新的画布,并激活/返回。若参数num为整数,Figure.number中的number以指定的该数字命名;若无指定标识符,使用自动生成的整数值(从1开始,递增)。若参数num是一个字符串,画布的标签与窗口的标题使用该字符串命名。
- 参数num为数字
import matplotlib.pyplot as pltfig = plt.figure(num=4, figsize=(2, 2), edgecolor='r')plt.show()
2. 参数num为字符串
import matplotlib.pyplot as pltfig = plt.figure(num='test', figsize=(2, 2), edgecolor='r')plt.show()
figsize: (float, float), default: rcParams[“figure.figsize”] (default: [6.4, 4.8])
Width, height in inches.
画布大小:一对浮点型坐标,宽度,高度以英寸为单位。默认为[6.4, 4.8].
import matplotlib.pyplot as pltfig1 = plt.figure(num='test1', figsize=(2,1))
fig2 = plt.figure(num='test2', figsize=(4,2))plt.show()
dpi: float, default: rcParams[“figure.dpi”] (default: 100.0)
The resolution of the figure in dots-per-inch.
分辨率: 画布的分辨率,以每英寸点数为单位。默认为:100
相同的figsize,dpi越大,画布越大
import matplotlib.pyplot as pltfig1 = plt.figure(num='test1', figsize=(4,2), dpi=100)
fig2 = plt.figure(num='test2', figsize=(4,2), dpi=200)plt.show()
facecolor: color, default: rcParams[“figure.facecolor”] (default: ‘white’)
The background color.
画布背景颜色: 默认为: 白色
import matplotlib.pyplot as pltfig = plt.figure(num='test', figsize=(5,4), dpi=100,facecolor='y',edgecolor='r')plt.show()
edgecolor: color, default: rcParams[“figure.edgecolor”] (default: ‘white’)
The border color.
import matplotlib.pyplot as plt# fig1 = plt.figure(num='test1', figsize=(10,10), dpi=50, facecolor='r', frameon=True)
fig2 = plt.figure(num='test2', figsize=(4,2), dpi=200, facecolor='c', edgecolor='r',frameon=True,linewidth=5)plt.show()
frameon: bool, default: True
If False, suppress drawing the figure frame.
画布框架:布尔型,默认:True,若为False,禁止绘制图形框架
从图中可以看出画布框架即上图红色边框里面的部分,当frameon-=False,则不能显示背景颜色与边界颜色。
import matplotlib.pyplot as plt# fig1 = plt.figure(num='test1', figsize=(10,10), dpi=50, facecolor='r', frameon=True)
fig2 = plt.figure(num='test2', figsize=(4,2), dpi=200, facecolor='c', edgecolor='r',frameon=False,linewidth=5)plt.show()
FigureClass: subclass of Figure
Optionally use a custom Figure instance.(不清楚)
clear: bool, default: False
If True and the figure already exists, then it is cleared.
清除:布尔型,默认:False.若为True,将清除已存在画布。
以下参数待研究:
tight_layout: bool or dict, default: rcParams[“figure.autolayout”] (default: False)
If False use subplotpars. If True adjust subplot parameters using tight_layout with default padding. When providing a dict containing the keys pad, w_pad, h_pad, and rect, the default tight_layout paddings will be overridden.
constrained_layout: bool, default: rcParams[“figure.constrained_layout.use”] (default: False)
If True use constrained layout to adjust positioning of plot elements. Like tight_layout, but designed to be more flexible. See Constrained Layout Guide for examples. (Note: does not work with add_subplot or subplot2grid.)
kwargs : optional
See Figure for other possible arguments.
官方文档: figure参数
figure函数--Matplotlib相关推荐
- python figure函数_Python Matplotlib.figure.Figure.add_axes()用法及代码示例
Matplotlib是Python中的一个库,它是数字的-NumPy库的数学扩展. Figure模块提供了顶层Artist,即Figure,其中包含所有绘图元素.此模块用于控制所有图元的子图和顶层容器 ...
- subplots与figure函数参数解释说明以及简单的使用脚本实例
无意中发现了一个很好的软件测试网站,忍不住分享一下给大家.觉得很实用,所以分享给大家.点这里可以跳转到教程. matplotlib.pyplot.subplots(nrows=1, ncols=1, ...
- figure函数用法
目录 语法 说明 示例 指定图窗标题 同时使用多个图窗 Python中用法 figure函数的功能是创建图窗窗口 语法 figurefigure(Name,Value)f = figure(___)f ...
- Python使用matplotlib绘图并去除颜色样条colorbar实战:remove colorbar from figure in matplotlib
Python使用matplotlib绘图并去除颜色样条colorbar实战:remove colorbar from figure in matplotlib 目录 Python使用matplotli ...
- 魔法函数%matplotlib 解决matplotlib画图在Jupter/IPython中不显示
用Python画图时,有时候画图结果存储在内存中不显示,如下图 import seaborn as sns subset = tz_counts[:10] sns.barplot(y=subset.i ...
- Matlab学习笔记 figure函数
Matlab学习笔记 figure函数 matlab中的 figure 命令,能够创建一个用来显示图形输出的一个窗口对象.每一个这样的窗口都有一些属性,例如窗口的尺寸.位置,等等.下面一一介绍它们. ...
- MATLAB中 figure() 函数的用法详解-图文
作者按:Matlab中的 figure() 函数主要用于建立图形窗口 用法一 默认参数 >>figure; %默认参数 用法二 和其他图窗函数配合使用,用于建立新窗口显示图形 >&g ...
- subplots_adjust()函数--matplotlib
1. 函数功能 调整子区的展现效果 2. 函数语法 subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, ...
- setp函数--Matplotlib
函数功能: Set a property on an artist object. 设置元素属性 函数语法: setp(obj, *args, **kwargs) 函数参数: obj: 要设置的对象 ...
- xlabel函数--Matplotlib
xlabel函数使用–Matplotlib xlabel语法.功能与参数设置可平移至ylabel. 函数语法: xlabel(xlabel, fontdict=None, labelpad=None, ...
最新文章
- mysql授权其他用户导出数据_mysql创建账号、授权、数据导出、导入
- RDKit | 基于RDKit绘制带原子和键的索引、注释和立体化学
- Java中文编码小结
- 英文题,我恨你啊..
- Linux is执行程序命令,linux命令执行过程详解
- 创建一个plugin - drupal 8
- python3.7代码_Centos7源代码安装python3.7,centos7,源码,python37
- mysql 学生成绩等级_JSP+SSM+Mysql实现的学生成绩管理系统
- 怎么用python表白_如何正确使用Python进行表白?这是个值得思考的问题!
- ELT和ETL分不清楚?2张图就能理解透彻
- Python字典二次开发实现稀疏矩阵表示与简单计算
- 海湾火灾自动报警系统中文编码查询表
- ps里面的css,PS中如何添加图层样式
- HBuilder开发App教程
- 利用R绘制venn图(VennDiagram、eulerr、venneuler、limma)
- 2018ICPC网络赛(焦作站)E题题解
- 用Haskell写的卡普雷尔卡kaprekar黑洞小程序
- java 魔法数_魔法数字与常量定义
- 红旗桌面4.0正式版最新使用方法和问题解答100例
- qt获取本机全部ipv4_QT5下获取本机IP地址、计算机名、网络连接名、MAC地址、子网掩码、广播地址...
热门文章
- unity IEnumerator 协程的理解
- Atitit 提升记忆的稳定性防止遗忘 目录 1. 存储稳定性(记忆牢固性),需要多处存储,提升稳定性	1 2. 方法分类原则	2 2.1. 常复习	2 2.2. 复习方法多样化 利用多种感官	2
- Atitit 多线程 什么时候使用多进程的选择场景 目录 1.1. 看实现,比如你的用node.js实现,那就没得选了,只能多进程	1 1.2. 如果用java这一类,可以选择多进程与多线程模式,或
- Atitit 分布式之道 attilax著 第4章 通信 第7章 一致性和复制 第8章 容错性 第9章 安全性 第10章 基于对象的分布式系统 第11章 分布式文件系统 第12章 基于Web的分
- Atitit 数据分析存储位置的查找方法与流程attilax总结
- Atitit.创业之uke团队规划策划 v9
- Atitit Gaussian Blur 高斯模糊 的原理and实现and 用途
- paip. mysql如何临时 暂时 禁用 关闭 触发器
- 【原创】无冕之王 Julian Robertson旗下小虎群总规模2500亿美金
- 资管运营BAND原创 | 他山之石:境外基金业绩报酬计算方法(二)