one common y label for the subplots
64 ビュー (過去 30 日間)
古いコメントを表示
I am trying to remove the y labels in the inner plots of my subplot figures by using straightforward codes which I couldn't, here's my code,
here I used position for ylabel which didn't work
is there a short way for this?
for r=1:10
subplot(2,13,r)
plot(u_lat_con(:,r)./Uund,yler_D2,'r');
xlabel('$\overline{u}/U_0$','interpreter','latex')
% ylabel('$y/D$','interpreter','latex')
ylabel('$y/D$','position',[-1 8],'interpreter','latex')
title(sprintf('x/D=%.2f',xler_c(r)./D))
xlim([-0.3 1.3]);
ylim([0 3.1133]);
end
% ylabel('$y/D$','POSITION',[-1 8],'interpreter','latex')
for r=1:13
subplot(2,13,r+13)
plot(u_lat_w(:,r)./Uund,yler_D1,'b',u_lat_w(:,r)./Uund,-yler_D1,'b');
xlabel('$\overline{u}/U_0$','position',[4 7],'interpreter','latex')
% ylabel('$y/D$','interpreter','latex')
title(sprintf('x/D=%.2f',xler1(r)./D))
xlim([-0.3 1.3])
ylim([-3.5 3.5])
end
0 件のコメント
採用された回答
Cris LaPierre
2021 年 10 月 14 日
編集済み: Cris LaPierre
2021 年 10 月 14 日
If you use tiledlayout instead of subplot, you can add shared title and axis labels. See this example.
t = tiledlayout(2,2,'TileSpacing','Compact');
% Tile 1
nexttile
plot(rand(1,20))
% Tile 2
nexttile
plot(rand(1,20))
% Tile 3
nexttile
plot(rand(1,20))
% Tile 4
nexttile
plot(rand(1,20))
% Create shared title, xlabel and ylabel
title(t,'Size vs. Distance')
xlabel(t,'Distance (mm)')
ylabel(t,'Size (mm)')
2 件のコメント
Cris LaPierre
2021 年 10 月 14 日
編集済み: Cris LaPierre
2021 年 10 月 14 日
If you can do it with subplot, you should be able to do it with tiledlayout. You can jump to a specific tile using the syntax nexttile(7). For example, if your grid is 3x3, that command will take you to the bottom left tile.
This is equivalent to subplot(3,3,7).
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!