Need guidance in using function subplot

1 回表示 (過去 30 日間)
lech king
lech king 2020 年 11 月 29 日
コメント済み: lech king 2020 年 11 月 29 日
Hello
In a 2 * 2 mode, function subplot works well and the third and fourth places are assigned to the third image.
Example
subplot (2,2,1),imshow(pic1)
subplot (2,2,2),imshow(pic2)
subplot (2,2,[3,4]),imshow(pic3)');
But in a 4 * 5 mode, for example, I want a photo to be placed in places 3, 8, 13 , 18, what should I do ??
Thanks for your help

採用された回答

Image Analyst
Image Analyst 2020 年 11 月 29 日
編集済み: Image Analyst 2020 年 11 月 29 日
Try this:
% Put image into central column.
% Note: it will maintain the aspect ratio of the image
% and not be stretched vertically into a tall and skinny image.
subplot(4, 5, [3, 8, 13 , 18]);
imshow(pic);
  7 件のコメント
Image Analyst
Image Analyst 2020 年 11 月 29 日
Try this:
pic = imread('river.jpeg');
[rows, columns, numColors] = size(pic)
% Resize image to be 5 times as tall as it is wide
stretchFactor = 5;
pic = imresize(pic, [columns * stretchFactor, columns]);
for k = 1 : 20
subplot(4, 5, k);
text(0.5, 0.5, num2str(k));
end
% Put image into central column.
% Note: it will maintain the aspect ratio of the image
% and not be stretched vertically into a tall and skinny image.
subplot(4, 5, [3, 8, 13 , 18]);
imshow(pic);
The stretchFactor will vary depending on the shape and size of the figure so you might want to specify that in advance so that it looks the same on everyone else's computer.
lech king
lech king 2020 年 11 月 29 日
Thank you very much
Thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by