Display colorbar label horizontally and specify its position

22 visualizaciones (últimos 30 días)
Viesturs Veckalns
Viesturs Veckalns el 24 de Oct. de 2017
Editada: KL el 24 de Oct. de 2017
In this example
figure;
[x, y, z] = sphere;
surf(x, y, z);
c = colorbar;
c.Label.String = 'Z';
I would like the colorbar label to be displayed vertically and in the top right corner off the colorbar. How can I do it?

Respuesta aceptada

KL
KL el 24 de Oct. de 2017
Editada: KL el 24 de Oct. de 2017
EDITED
pos = get(c,'Position');
c.Label.Position = [pos(1)/2 pos(2)+1]; % to change its position
c.Label.Rotation = 0; % to rotate the text
  2 comentarios
Viesturs Veckalns
Viesturs Veckalns el 24 de Oct. de 2017
I don't want to change the location of the colorbar but the location of the colorbar label.
KL
KL el 24 de Oct. de 2017
Ah ok, I completely missed it. Check my edited answer.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by