我试图让3张图像在matlab中并排显示.但是当我使用子图时,它们的间隔不均匀.第一个和第二个是25 x 25 pxl图像,第三个是25 x 75图像.
我怎样才能让它像展示一样
+-----++-----++---------------+
| img || img || img |
| 1 || 2 || 3 |
+-----++-----++---------------+
Run Code Online (Sandbox Code Playgroud)
您可以使用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
Run Code Online (Sandbox Code Playgroud)
注意:
轴的位置可以将h=subplot(...)手柄返回到新创建的轴.然后,您可以使用set调整轴或您可以使用
h=subplot('position', [left bottom width height])
Run Code Online (Sandbox Code Playgroud)
手动将轴放在图中.另外,请注意这些功能get(h,'prop'),set(h,'prop',value)也可用于调整其他轴属性.有关所有可用属性的文档,请参阅轴上的MATHWORK的手柄图形浏览器部分.
另一种选择是创建一个新图像:
abuttedImage = [im1 im2 im3];
Run Code Online (Sandbox Code Playgroud)
只要每个图像中的行数相同,这就会起作用。