我有以下子图,并使用imagesc
命令打印图像。如何使颜色条的大小与两个图形相匹配,并且标签上标明了#34; [m]"或" [度]"就在颜色条旁边(用水平对齐书写)?
f_prova3 = figure();
s1 = subplot(1,2,1); imagesc(DEM); axis equal; axis off;
hb1 = colorbar('location','eastoutside');
s2 = subplot(1,2,2); imagesc(slopeMap_int); colormap jet, axis equal;axis off;
hb2 = colorbar('location','eastoutside');
抱歉,我似乎无法直接添加图片。谢谢你的帮助
答案 0 :(得分:3)
您可以添加axis tight
来调整高度,并使用标签属性来调整标签:
DEM = magic(5);
slopeMap_int = magic(5);
f_prova3 = figure();
s1 = subplot(1,2,1); imagesc(DEM); axis equal; axis tight; axis off;
hb1 = colorbar('location','eastoutside');
s2 = subplot(1,2,2); imagesc(slopeMap_int); colormap jet; axis equal; axis tight; axis off;
hb2 = colorbar('location','eastoutside');
hb1.Label.String = '[m]';
hb1.Label.Rotation = 0;
hb1.Label.HorizontalAlignment = 'Left';
hb2.Label.String = '[deg]';
hb2.Label.Rotation = 0;
hb2.Label.HorizontalAlignment = 'Left';
我在Matlab R2016a中测试过。