Shrinking the height of the colorbar

83 Ansichten (letzte 30 Tage)
dustin
dustin am 6 Okt. 2014
Bearbeitet: Chad Greene am 6 Okt. 2014
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?

Akzeptierte Antwort

Chad Greene
Chad Greene am 6 Okt. 2014
cb = colorbar;
set(cb,'position',[.15 .1 .1 .3])
where the position arguments are [xposition yposition width height].
  3 Kommentare
Chad Greene
Chad Greene am 6 Okt. 2014
Ah, change it to
cb = colorbar('east');
set(cb,'position',[.15 .1 .1 .3])
Chad Greene
Chad Greene am 6 Okt. 2014
Bearbeitet: Chad Greene am 6 Okt. 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')

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by