matlab figure函数的用法用法1
>> figure % 创建一个新的窗口,所有参数采用默认
用法2
>> figure(s) % s为参数,s为数据时要大于0,否则报错
比如下例:
用法3
>> figure(‘PropertyName’,propertyvalue,…)
如下例:
>> figure('position',[200,200,500,500]) % 指定窗口位置 [left ,bottom,width,height]
>> figure('NumberTitle','off') % 关闭默认显示名字
>> figure('toolbar','none','menubar ','none') % 不显示工具栏,菜单栏
用法4
>> h = figure(s) % 返回该窗口的句柄,其中,s是一个整数
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn 
matplotlib的基本用法——figure的使用Demo 2
# figure的使用
x = np.linspace(-1, 1, 50)
y1 = 2 * x + 1
# figure 1
plt.figure()
plt.plot(x, y1) # figure 2
y2 = x**2
plt.figure()
plt.plot(x, y2)
# figure 3,指定figure的编号并指定figure的大小, 指定线的颜色, 宽度和类型 y2 = x**2
plt.figure(num = 5, figsize = (4, 4))
plt.plot(x, y1)
plt.plot(x, y2, color = 'red', linewidth 【Python】 【绘图】plt.figure()的使用1.figure语法及操作
(1)figure语法说明
figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True)
num:图像编号或名称,数字为编号 ,字符串为名称
figsize:指定figure的宽和高,单位为英寸;
dpi参数指定绘图对象的分辨率,即每英寸多少个像素,缺省值为80 /api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure
import numpy as np
import matplotlib.pyplot as plt
#新建figure
fig = plt.figure()
# 定义数据
x = [1, 2, 3, 4, 5, 6, 7]
y = [1, 3, 4, 2, 5, 8, 6] #新建区域ax1
#figure的百分比,从figure 10%的位置开始绘制, 宽高是figure的80%
left, bottom, width, height = 0.1, 0.1, 0.8