我在Matlab GUI中有一个按钮,用于在新图中打开轴图,这是我的代码:
fig=figure;
set(fig, 'Position', [100, 100, 1049, 895]);
h=handles.axes2;
copyobj(h,fig);
set(gca,'units','pix')
set(gca,'units','norm')
然而,新图中的轴非常小:
但是当我尝试在前面代码的底部添加这一行时:
set(gca,{'Position',[100, 100, 1049, 895]}); % [left bottom right top]
没有任何变化......我也尝试过改变数字,但轴没有调整大小......
谁能告诉我我做错了什么?
由于
答案 0 :(得分:1)
使用axis命令:
% whatever code you have
plot(x,y,'-o');
% now add limits for the axisX and axisY
% that combined with the position limit should zoom your picture automatically
% x1, x2, y1, y2 should be actual values like 0.5, 1, -4 etc. whatever you find appropriate
% if it doesnt zoom as you expect - remove the Position setting and see how it looks.
axis([x1 x2 y1 y2]);
有关更多信息,请参阅matlab网站上的示例:http://www.mathworks.com/help/matlab/ref/axis.html
答案 1 :(得分:1)