How can I make a subplot of subplots?

165 ビュー (過去 30 日間)
Carolina Scandellari
Carolina Scandellari 2020 年 1 月 29 日
回答済み: Ganesh Regoti 2020 年 2 月 3 日
Hi everyone, I'd like to create a figure (3 rows and 2 columns) using a for loop: every row is made up of other 2 subplots that I create with a function that is in the loop. Do you know how? This is the code I am currently using:
title_figure1='Sensitivity';
title_figure2='FPR';
high=list_snr(1);
mid=list_snr(5);
low=list_snr(10);
chosen_snr=[high, mid, low];
for j=1:length(chosen_snr)
figure(1)
ax=subplot(j,2,:)
make_figure_sens_fpr(ax,list_smooth_factor,squeeze(SENSITIVITY((list_snr==chosen_snr(l)),:,:)),squeeze(FP_rate_all((list_snr==chosen_snr(l)),:,:)),............)
end
function make_figure_sens_fpr(....)
............
h(1)=subplot(1,2,1);
imagesc(ax,sensitivity(:,:));
h(2)=subplot(1,2,2);
imagesc(ax,FP_rate(:,:))
..........
end
Thank you
  2 件のコメント
Mohammad Sami
Mohammad Sami 2020 年 1 月 30 日
So you essentialy want to do 3 row and 4 columns ?
Rik
Rik 2020 年 1 月 30 日
As Mohammad implies: do you need to create the axes this way in your function, or would it also be possible to pass handles as variables?

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

回答 (1 件)

Ganesh Regoti
Ganesh Regoti 2020 年 2 月 3 日
Hi,
As per my knowledge, it is not possible to create subplot within subplot as the function returns the axis by default. Instead you can create 3 rows, 4 columns sub-plot for your purpose.
You can refer following link for more understanding
Also refer about the tiledlayout which might be helpful
Hope this helps!

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by