博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

[转] matlab figure最大化

Posted on 2013-07-02 15:37  编著人  阅读(2282)  评论(0编辑  收藏  举报

http://blog.163.com/yinhexiwen@126/blog/static/6404826620122942057214/

% figure 窗口最大化,坐标轴也随着窗口变大而相应变大
scrsz = get(0,'ScreenSize');
set(gcf,'Position',scrsz);

或者

set(gcf,'outerposition',get(0,'screensize'));

get(0,'ScreenSize'); 是为了获得屏幕大小,Screensize是一个4元素向量[left, bottom, width, height],然后用获得的screensize向量设置fig的position属性;
get(0) 获取root object(根对象),根对象的所有属性和属性值见:http://www.baisi.net/viewthread.php?tid=6020

例:
To create a figure window that is one quarter the size of your screen and is positioned in the upper left corner, use the root object's ScreenSize property to determine the size. ScreenSize is a four-element vector: [left, bottom, width, height]:
scrsz = get(0,'ScreenSize');
figure('Position',[1 scrsz(4)/2 scrsz(3)/2 scrsz(4)/2])

其实就是用来获得显示器的尺寸,然后确定新建窗口的位置和大小。

代替subplot:

figure,

axes('position',[0  0.54  0.45  0.45]),imshow(im1),axis off;

axes('position',[0.5  0.54  0.45  0.45]),plotflow(flow),axis off;

axes('position',[0  0.08  0.45  0.45]),plotflow(flow,'mag'),axis off;

axes('position',[0.5  0.08  0.45  0.45]),imshow(imflow),axis off;