大家好,我在matlab中有几个问题:
假设我有5幅图像,我想在matlab图形窗口中绘制所有这些图像。我如何做到这一点呢?这意味着我想把两个图像放在第一行,3个图像放在第二行。我实际上想要这个输出。

或者类似这样的东西:

请记住,我想在两个图形窗口的顶行居中对齐图像。简而言之,我想知道如何在matlab图形窗口中具体设置子图的位置?
另外,有没有什么方法可以给我的图形窗口一个主标题?我不想使用函数SUPLABEL
我使用的代码是:
h1=figure;
subplot(2,3,1);imshow(I_orignial);title('The original Image','FontWeight','bold','FontSize', 12);
subplot(2,2,2);imshow(aa1); title('1st segment','FontWeight','bold','FontSize', 12);
subplot(2,2,3);imshow(aa2); title('2nd segment','FontWeight','bold','FontSize', 12);
subplot(2,2,4);imshow(aa3); title('3rd segment','FontWeight','bold','FontSize', 12);
%//Please note that aa1,aa2 & aa3 are logical arrays and I_orignial is an uint8 image.
%//The size of the logical arrays is 64X64.
%//The size of the image is 160X221.另外,在图形上显示之前,有没有办法将我的子图图像调整到特定的大小?我的意思是,如何在matlab图形上将不同大小的图像强制为相同的子图大小?请注意:我不是在谈论imresize。
如果需要进一步的澄清,请给我回复!
提前感谢!!
发布于 2013-09-09 01:40:23
如果你想使用subplot,而不是直接指定轴的位置,你必须在你的脑海中将图形分割成最小的均匀区域,然后将它们组合成图。例如,要有三个大小相等的图,一个在顶部,两个在底部,您应该这样做:
firstAxes = subplot(2,4,2:3);
secondAxes = subplot(2,4,5:6);
thirdAxes = subplot(2,4,7:8);如果要执行更复杂的操作,例如将文本放在特定位置,最好直接创建显示对象。例如:
fh = figure;
hiddenAxes = axes('parent',fh,'units','normalized','position',[0 0 1 1],'color','w','xcolor','w','ycolor','w','xlim',[0 1],'ylim',[0 1]);
text('parent',hiddenAxes','position',[0.25 0.9 0.5 0.1],'horizontalAlignment','center','string','this is a centered title','fontWeight','bold')
firstAxes = axes('parent',fh,'units','normalized','position',[0.25 0.5 0.5 0.45]);
secondAxes = axes('parent',fh,'units','normalized','position',[0 0 0.5 0.45]);
thirdAxes = axes('parent',fh,'units','normalized','position',[0.5 0 0.5 0.45]);要控制图像大小,您需要更改轴限制。
发布于 2017-09-27 03:30:16
您也可以尝试
figure
subplot(2,3,1.5)
subplot(2,3,2.5)
subplot(2,3,4)
subplot(2,3,5)
subplot(2,3,6)

或
subplot(2,2,1.5)
subplot(2,2,3)
subplot(2,2,4)

https://stackoverflow.com/questions/18686122
复制相似问题