How to set eact part as the same size in the subplot ?

1 vue (au cours des 30 derniers jours)
wenhao yang
wenhao yang le 16 Sep 2021
Commenté : wenhao yang le 16 Sep 2021
Just like the figure, I want to set the same size of each part.
To control the width and length of subplot.
  4 commentaires
wenhao yang
wenhao yang le 16 Sep 2021
% plot figure 2
figure(2)
subplot(4,1,1)
% title('Reaction rate (g/m^3s)');
yyaxis left
plot(Z,Y_NH3,'-','linewidth',2);
xtickformat('%.2f');
ytickformat('%.1f');
ylabel('Y_N_{H_3}')
xlim([0.0,0.5]);
ylim([0,1]);
yyaxis right
plot(Z,w_NH3/(1000*moleW_NH3),'-','linewidth',2);
ytickformat('%.1f');
ylabel('\omega_N_{H_3}')
xlim([0.0,0.5]);
% 坐标轴字体
set(gca,'FontName','Times New Roman','FontSize',14);
% 坐标轴粗细
set(gca,'linewidth',1.5);
subplot(4,1,2)
yyaxis left
plot(Z,Y_O2,'-','linewidth',2);
xtickformat('%.2f');
ytickformat('%.1f');
ylabel('Y_{O_2}')
xlim([0.0,0.5]);
yyaxis right
plot(Z,w_O2/(1000*moleW_O2),'-','linewidth',2);
ytickformat('%.1f');
ylabel('\omega_{O_2}')
xlim([0.0,0.5]);
% 坐标轴字体
set(gca,'FontName','Times New Roman','FontSize',14);
% 坐标轴粗细
set(gca,'linewidth',1.5);
subplot(4,1,3)
yyaxis left
plot(Z,Y_NH,'-','linewidth',2);
ax = gca;
ax.YAxis(1).Exponent = -4;
xtickformat('%.2f');
ytickformat('%.1f');
ylabel('Y_N_H')
yyaxis right
plot(Z,w_NH/(1000*moleW_H),'-','linewidth',2);
ax.YAxis(2).Exponent = 4;
ytickformat('%.1f');
ylabel('\omega_N_H')
xlim([0.0,0.5]);
% 坐标轴字体
set(gca,'FontName','Times New Roman','FontSize',14);
% 坐标轴粗细
set(gca,'linewidth',1.5);
subplot(4,1,4)
yyaxis left
plot(Z,Y_NH2,'-','linewidth',2);
ax = gca;
ax.YAxis(1).Exponent = -3;
xtickformat('%.2f');
ytickformat('%.1f');
ylabel('Y_N_{H_2}')
yyaxis right
plot(Z,w_NH2/(1000*moleW_NH2),'-','linewidth',2);
ax.YAxis(2).Exponent = 3;
xlabel('Mixture fraction (-)')
ytickformat('%.1f');
ylabel('\omega_N_{H_2}')
xlim([0.0,0.5]);
% 坐标轴字体
set(gca,'FontName','Times New Roman','FontSize',14);
% 坐标轴粗细
set(gca,'linewidth',1.5);
set(gcf,'PaperUnits','centimeters');
% set(gcf,'Position',[0.18 0.18 0.75 0.70]);
set(gcf,'PaperPosition',[1 10 20 20]);
print(gcf,'-r600','-dpng','r1.png')
close all
wenhao yang
wenhao yang le 16 Sep 2021
I use these two commands to get two figures. However, they are not exactly the same in the size of each subplot. Their axises are not in the same position when I compare these two figures. The first one is a liitle bigger than the second one.
So, I wanna make the subplot size, widh and length exactly the same position.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by