Multiple ylabels for tiledlayout

33 次查看(过去 30 天)
Cunxin Huang
Cunxin Huang 2024-3-26
编辑: Matt J 2024-4-11,20:13
Suppose I am drawing a 4*6 figure with tiledlayout. Now I want to let the first and the second rows of figures share the same ylabel, and so do the third and the fourth rows. I looked for solutions but found nothing useful. I tried to create two different tiledlayout on one figure, but it turns out that tiledlayout function does not allow this. Thus, is there any suggestions?

回答(1 个)

Matt J
Matt J 2024-3-26
编辑:Matt J 2024-3-26
One approach would be to create a 2x1 tiledlayout where inside each tile you nest another tiledlayout of dimension 2x6. You can facilitate this by downloading nestedLayouts() from the File Exchange,
Example:
[ax,t,T]=nestedLayouts([2,1],[2,6]);
for i=1:numel(ax) %populate all 24 axes with plot data
plot(ax(i),rand(1,5));
end
for i=1:numel(t) %Give each outer tile its own ylabel
ylabel(t(i),"ylabel No. "+i);
end
  5 个评论
Cunxin Huang
Cunxin Huang 2024-4-11,17:42
Yes. But I wonder if there exists a solution for an older version like R2019b.
Matt J
Matt J 2024-4-11,17:50
编辑:Matt J 2024-4-11,20:13
I haven't used it myself, but there is this FEX offering,
which has a "Pick of the Week" designation to vouch for it.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by