Shrinking the height of the colorbar
148 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Chad Greene
on 6 Oct 2014
cb = colorbar;
set(cb,'position',[.15 .1 .1 .3])
where the position arguments are [xposition yposition width height].
3 Comments
Chad Greene
on 6 Oct 2014
Ah, change it to
cb = colorbar('east');
set(cb,'position',[.15 .1 .1 .3])
Chad Greene
on 6 Oct 2014
Edited: Chad Greene
on 6 Oct 2014
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')
More Answers (0)
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!