matlab文字和图一起缩放,MATLAB - 如何将子图缩放在一起?

使用 linkaxes 作为Yair和Amro已经建议 . 以下是您案例的快速示例

ha(1) = subplot(2,1,1); % get the axes handle when you create the subplot

plot([1:10]); % Plot random stuff here as an example

ha(2) = subplot(2,1,2); % get the axes handle when you create the subplot

plot([1:10]+10); % Plot random stuff here as an example

linkaxes(ha, 'x'); % Link all axes in x

您应该能够同时放大所有子图

如果有许多子图,并且逐个收集它们的轴手柄似乎不是一个聪明的方法来完成这项工作,你可以通过以下命令找到给定图形句柄中的所有轴处理

figure_handle = figure;

subplot(2,1,1);

plot([1:10]);

subplot(2,1,2);

plot([1:10]+10);

% find all axes handle of type 'axes' and empty tag

all_ha = findobj( figure_handle, 'type', 'axes', 'tag', '' );

linkaxes( all_ha, 'x' );

第一行查找 figure_handle 类型 figure_handle 下的所有对象和空标记('') . 空标记的条件是排除图例的斧柄,其标记为 legend .

如果它不仅仅是一个简单的图,那么你的图中可能还有其他轴对象 . 在这种情况下,您需要添加更多条件来标识您感兴趣的图的轴控制柄 .

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值