MATLAB使用subplot绘图调整子图的位置和大小

本文详细介绍使用Matlab进行复杂绘图的方法,包括如何设置图形窗口属性、子图布局及调整坐标轴显示,同时深入探讨了如何精确控制图例、标签字体大小与位置,为科研工作者和工程师提供实用的绘图技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

figure(3)
set(gcf,'color',[1 1 1])
set(gcf,'position',[150 10 600 800])
subplot(221)
plot(t1,V_b1(id*3-2,:),'color','r')
axis tight
h=legend('Case1');
set(h,'box','off','fontsize',6,'location','best')
xlabel('Time/s','fontsize',10)
ylabel('X-Velocity/m/s','fontsize',10)
set(gca,'position',[0.08 0.55 0.4 0.43])
subplot(222)
plot(t2,V_b2(id*3-2,:),'color','g')
axis tight
h=legend('Case2');
set(h,'box','off','fontsize',6,'location','best')
xlabel('Time/s','fontsize',10)
ylabel('X-Velocity/m/s','fontsize',10)
set(gca,'position',[0.58 0.55 0.4 0.43])
subplot(223)
plot(t3,V_b3(id*3-2,:),'color','b')
axis tight
h=legend('Case3');
set(h,'box','off','fontsize',6,'location','best')
xlabel('Time/s','fontsize',10)
ylabel('X-Velocity/m/s','fontsize',10)
set(gca,'position',[0.08 0.06 0.4 0.43])
subplot(224)
plot(t4,V_b4(id*3-2,:),'color','k')
axis tight
h=legend('Case4');
set(h,'box','off','fontsize',6,'location','best')
xlabel('Time/s','fontsize',10)
ylabel('X-Velocity/m/s','fontsize',10)
set(gca,'position',[0.58 0.06 0.4 0.43])

其中set(gca,‘position’,[0.58 0.06 0.4 0.43 ])
四个数分别代表距y轴的距离、距x轴的距离、图宽、图长

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值