Multiple ylabels for tiledlayout

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일

0 개 추천

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년 3월 26일
Thanks for your comment. I agree that this kind of nested tiledlayout is a good solution.
Cunxin Huang
Cunxin Huang 2024년 4월 11일
편집: Cunxin Huang 2024년 4월 11일
Hi! I found there is a problem: when we use old version MATLAB (I tried R2019b), this method will lead to the following error:
"
Error using tiledlayout
TiledChartLayout cannot be a child of TiledChartLayout.
"
Matt J
Matt J 2024년 4월 11일
편집: Matt J 2024년 4월 11일
The answer applies to the Matlab version that you posted with your question,
Cunxin Huang
Cunxin Huang 2024년 4월 11일
Yes. But I wonder if there exists a solution for an older version like R2019b.
Matt J
Matt J 2024년 4월 11일
편집: Matt J 2024년 4월 11일
I haven't used it myself, but there is this FEX offering,
which has a "Pick of the Week" designation to vouch for it.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Axes Appearance에 대해 자세히 알아보기

제품

릴리스

R2023a

질문:

2024년 3월 26일

편집:

2024년 4월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by