如何在 Matlab 子图上使用 movegui() 分配图形 属性?
How to assign figure property with movegui() on Matlab subplot?
我需要为子图 (1-2) 分配单位 英寸。
我为该图添加了 movegui() ,之后我开始出现错误。
没有它,我不会收到错误消息。
代码
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
OS:Debian 8.5 64 位
我无法重现你的错误,但如果你想为特定的子图分配单位,然后明确地为它们分配它,而不是依赖于 hFig3.Children
到 return 特定顺序的子图.您可以通过将 axes
数组传递给 set
.
来完成此操作
set([b1 b2], 'Units', 'inches')
或者如果你真的想使用点符号,你可以单独使用它们
b1.Units = 'inches';
b2.Units = 'inches';
或者您可以在创建它们时设置它
subplot(2, 2, 1, 'Units', 'Inches');
我需要为子图 (1-2) 分配单位 英寸。 我为该图添加了 movegui() ,之后我开始出现错误。 没有它,我不会收到错误消息。 代码
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
OS:Debian 8.5 64 位
我无法重现你的错误,但如果你想为特定的子图分配单位,然后明确地为它们分配它,而不是依赖于 hFig3.Children
到 return 特定顺序的子图.您可以通过将 axes
数组传递给 set
.
set([b1 b2], 'Units', 'inches')
或者如果你真的想使用点符号,你可以单独使用它们
b1.Units = 'inches';
b2.Units = 'inches';
或者您可以在创建它们时设置它
subplot(2, 2, 1, 'Units', 'Inches');