4

我试图让 3 张图像在 matlab 中并排显示。但是当我使用 subplot 时,它们的间距不均匀。第一个和第二个是 25×25 像素的图像,第三个是 25×75 的图像。

我怎样才能让它像

+-----++-----++---------------+
| img || img ||     img       |
|  1  ||  2  ||      3        |
+-----++-----++---------------+
4

2 回答 2

9

您可以使用subplot跨越多个网格方块。对于您的示例,请尝试

subplot(1,4,1)
subplot(1,4,2)
subplot(1,4,3:4) % this will expand the third axes over the last two grid squares

笔记:

轴的位置可以h=subplot(...)返回到新创建的轴的句柄。然后您可以使用set来调整轴,或者您可以使用

h=subplot('position', [left bottom width height])

手动将轴放置在图中。此外,请注意功能get(h,'prop')set(h,'prop',value)也可用于调整其他轴属性。有关所有可用属性的文档,请参阅轴上的 MATHWORK 的句柄图形浏览器部分。

于 2012-04-04T16:27:54.710 回答
5

另一种选择是创建一个新图像:

abuttedImage = [im1 im2 im3]; 

只要每个图像中的行数相同,这将起作用。

于 2012-04-05T13:52:29.297 回答