フィルターのクリア

How to plot images with different sizes in one figure?

17 ビュー (過去 30 日間)
xiaojuezi
xiaojuezi 2020 年 7 月 4 日
コメント済み: xiaojuezi 2020 年 7 月 4 日
I have 5 images and I would like to plot them like:
fig1 fig2
fig3 fig4 fig5
i.e. I would like to have two rows, the first row does something like;
subplot(1,2,1)
imshow(fig1)
subplot(1,2,2)
imshow(fig2)
and the second row:
subplot(1,3,1)
imshow(fig3)
subplot(1,3,2)
imshow(fig4)
subplot(1,3,3)
imshow(fig5)
If I use span, the first row is not centered. If I use subplot I could only have 2x3 grid, are there anyway to achieve this ?

採用された回答

Image Analyst
Image Analyst 2020 年 7 月 4 日
The first argument to subplot needs to be 2 because there are 2 rows. The layout is this:
1 2
3 4
For the first two plots, the second argument is 2 because there are 2 columns, and the third argument will be 1 and 2.
For the next row, you also have 2 rows. The layout for subplot(2, 3,n) is this
1 2 3
4 5 6
So you need to put the images into slots 4, 5, and 6 because you want them in the second row, not the first row. Here is the corrected code.
subplot(2,2,1)
% imshow(fig1)
subplot(2,2,2)
% imshow(fig2)
subplot(2,3,4)
% imshow(fig3)
subplot(2,3,5)
% imshow(fig4)
subplot(2,3,6)
% imshow(fig5)
  1 件のコメント
xiaojuezi
xiaojuezi 2020 年 7 月 4 日
Thank you very much!

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

その他の回答 (0 件)

カテゴリ

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