Colorbar 调整子图的大小

Colorbar resizes the subplots

我正在尝试使用 subplot 在 MATLAB 中并排绘制 3 张图像:

maxValue =  9;
minValue =  5;

figure(1)
subplot(1,3,1);
imshow(im1);
axis equal;

subplot(1,3,2);
imagesc(im2);colorbar;
caxis([minValue maxValue]) 
axis equal;

subplot(1,3,3);
imagesc(im3);colorbar;
caxis([minValue maxValue]) 
axis equal;

但结果是这样的:

显然颜色条正在调整图像大小。如何使所有 3 张图像大小相同,并且颜色栏适合图像的大小?

您的图片已根据可用 space.
调整大小以保持其纵横比 使用 axis normal; 作为 subplot(1,3,1) 而不是 axis equal.
您可能还需要最大化数字 window。


对于im1 = imread('peppers.png');,结果是:

这是我最后做的:

fig = figure(1);
set(fig, 'Position', [52 529 1869 445]); % Resize the image
subplot(1,3,1); % Add a subplot
subaxis(1,3,1, 'Spacing', 0.03, 'Padding', 0, 'Margin', 0); % Remove whitespace from subplot
imshow(im);
axis equal; % Use undistorted images


subplot(1,3,2);
subaxis(1,3,2, 'Spacing', 0.03, 'Padding', 0, 'Margin', 0);
imagesc(depth_gt);colorbar;
caxis([minValue maxValue]) 
axis equal;


subplot(1,3,3);
subaxis(1,3,3, 'Spacing', 0.03, 'Padding', 0, 'Margin', 0);
imagesc(depth_pred);colorbar;
caxis([minValue maxValue]) 
axis equal;

你可以得到这个 'position' 我手动调整图像大小然后在 Matlab 命令终端中打印 fig 的输出