如何在Matlab子图上使用movegui()分配图形属性? [英] How to assign figure property with movegui() on Matlab subplot?

查看:181
本文介绍了如何在Matlab子图上使用movegui()分配图形属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为子图(1-2)分配单位 inches . 我为该图添加了 movegui(),此后我开始出现错误. 没有它,我不会收到错误消息. 代码

I need to assign the units inches for subplots (1-2). I added movegui() for the figure, after which I started to get the error. Without it, I donot get the error message. Code

hFig3=figure('Units', 'inches', 'Name', 'Time, Potential, T-p, T-p tiff');
movegui(hFig3,'northeast'); % without this, you do not get the error
% TechnicalMonitoring
b1=subplot(2,2,1); 
b2=subplot(2,2,2); 
b3=subplot(2,2,3); 
b4=subplot(2,2,4); 

% b1, b2 
hFig3.Children(1).Units = 'inches';
hFig3.Children(2).Units = 'inches';

错误

No public property Units exists for class matlab.graphics.GraphicsPlaceholder.

Error in code_1s (line 488)
    hFig3.Children(1).Units = 'inches';

Matlab:2016a
操作系统:Debian 8.5 64位

Matlab: 2016a
OS: Debian 8.5 64 bit

推荐答案

我无法重现您的错误,但是如果您想为特定的子图分配单位,则为它们明确分配它,而不要依靠hFig3.Children返回子图按特定顺序排列.您可以通过将axes的数组传递给set来实现.

I cannot reproduce your error, but if you want to assign the units for specific subplots, then assign it explicitly for them rather than relying on hFig3.Children to return the subplots in a particular order. You can do this by passing an array of axes to set.

set([b1 b2], 'Units', 'inches')

或者,如果您真的想使用点符号,则可以单独进行

Or if you really want to use dot notation you can do them individually

b1.Units = 'inches';
b2.Units = 'inches';

或者您可以在创建它们时进行设置

Or you can just set this when they are created

subplot(2, 2, 1, 'Units', 'Inches');

这篇关于如何在Matlab子图上使用movegui()分配图形属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆