Shrinking the height of the colorbar
86 次查看(过去 30 天)
显示 更早的评论
When I am plotting with subplots and one of the plots is shorter than the other, the use of colorbar on the shorter plot makes it smaller. Can I shrink the height of the colorbar or make the plot taller?

0 个评论
采纳的回答
Chad Greene
2014-10-6
cb = colorbar;
set(cb,'position',[.15 .1 .1 .3])
where the position arguments are [xposition yposition width height].
3 个评论
Chad Greene
2014-10-6
Ah, change it to
cb = colorbar('east');
set(cb,'position',[.15 .1 .1 .3])
Chad Greene
2014-10-6
编辑:Chad Greene
2014-10-6
Alternatively, if horizontal space is an issue, consider using a horizontal colorbar with colorbar('south') or colorbar('northoutside') or whatever suits your fancy.
And yet another solution, is to let the first plot take up two-thirds of the figure
figure
subplot(1,3,[1:2])
plot(1:3,1:3,'r')
cb1 = colorbar('south');
subplot(1,3,3)
plot(10:20,10:20,'b')
cb2 = colorbar('northoutside')

更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!