Drawing multiple (10) subplots in the same figure

Hi everyone,
I want to present 10 subplots in the same figure, in two columns (means 5 rows). For example if the plots a are;
plot (t, S1), plot (t, S2), plot (t,S3), .... plot(t, S10),
how to 'set' the position of the specific plots in certain subplot so that I know which plot is at which location.
Thanks

1 件のコメント

DAIJIRY NARZARY
DAIJIRY NARZARY 2021 年 8 月 11 日
編集済み: DAIJIRY NARZARY 2021 年 8 月 11 日
Hi,
Its very simple and easy. You can use subplot (2,5,1);subplot(2,5,2)........(2,5,10). You will get the complete graph in 2 rows and 5 columns. Hope it helps.

サインインしてコメントする。

 採用された回答

Star Strider
Star Strider 2019 年 2 月 11 日

0 投票

The subplot function fills the subplot positions by row, so that the second subplot (subplot(5,2,2)) is the second subpot in the first row, the first subplot in the second row is subplot(5,2,3), and so for the rest. Just number them accordingly to put them where you want them.

5 件のコメント

Khan Engr
Khan Engr 2019 年 2 月 11 日
Thank you very much Star Strider, you have explained it very nicely, in a simple way.
The task is done.
Khan Engr
Khan Engr 2019 年 2 月 11 日
I have an associated question;
In my analysis it seems that the 10 subplot in one column makes the presetation more clear. But doing so, the plots apears so small and readbility is a problem. As the time on the x-axis is same for all plots, s it possible to 'remove' the x-axis of first 9 plots while the last (bottom) one remains.
Star Strider
Star Strider 2019 年 2 月 11 日
As always, my pleasure.
If you have R2018b or later, consider using the stackedplot (link) function.
To use subplot with a loop for example, this should work:
for k1 = 1:9
subplot(10,1,k1)
plot(rand(1, 100), rand(1,100))
grid
Ax = gca;
Ax.XAxis.Visible = 'off';
end
subplot(10,1,10)
plot(rand(1, 100), rand(1,100))
grid
xlabel('X-Axis Label')
Experiment to get the result you want.
Khan Engr
Khan Engr 2019 年 2 月 12 日
Thanks a lot again for guiding, the issue is sloved.
Star Strider
Star Strider 2019 年 2 月 12 日
As always, my pleasure.

サインインしてコメントする。

その他の回答 (0 件)

質問済み:

2019 年 2 月 11 日

編集済み:

2021 年 8 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by