Shrinking the height of the colorbar

83 visualizaciones (últimos 30 días)
dustin
dustin el 6 de Oct. de 2014
Editada: Chad Greene el 6 de Oct. de 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?

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by