MATLAB中 figure() 函数的用法详解-图文

作者按:Matlab中的 figure() 函数主要用于建立图形窗口

用法一 默认参数

>>figure;	%默认参数

用法二 和其他图窗函数配合使用,用于建立新窗口显示图形

>>figure,imhist(s);	%配合使用于多窗口显示
  %若不加figure, imhist()显示的图像会在figure1图窗中显示(覆盖imshow()的图像)

用法三 图形窗口属性及其参数(propertyname & propertyvalue)

>>figure('name','demo');    %图窗命名
>>figure('numbertitle','off');    %关闭图窗标题
>>figure('position', [left, bottom, width, height]);    %设定图窗位置(默认以屏幕的左下角为原点)和大小
>>figure('menubar','none','toolbar','none');    %关闭菜单栏(munubar)和工具栏(toolbar)
%多属性合并使用
>>figure('menubar','none','toolbar','none','numbertitle','off','position',[300,200,800,500]);

用法四 数字参数(数字是图形窗口的句柄标记)

>>figure(1);    %图形窗口 1
  figure(2);    %图形窗口 2
  %数字必须从1~2147483646的标量整数(参考matlab手册)

用法五 用于多图显示函数 subplot()之前,并结合 set()函数设定figure()的各项属性

>>wd = figure(1); 
  set(wd, 'name','总图标题', 'numbertitle', 'off');
  subplot(231), imshow(p),title('多图显示1');

个人经验,有不当指出还请评论指正。
更多用法参阅:https://ww2.mathworks.cn/help/matlab/ref/figure.html?searchHighlight=figure&s_tid=doc_srchtitle

猜你喜欢

转载自blog.csdn.net/qq_27677599/article/details/102246586