How to rotate xaxis labels (bar graph)

28 visualizaciones (últimos 30 días)
Colby
Colby el 10 de Mzo. de 2015
Respondida: Rae.K el 7 de Nov. de 2022
I'm having a very difficult time figuring out how to rotate the x-axis labels on a bar graph. If I have the code at the bottom, I get the error Undefined function or variable 'rotateXLabels'.
Error in Test1 (line 5) rotateXLabels(gca, 45);
numbers = magic(5) labels = {'label 1', 'label 2', 'label 3', 'label 4', 'label 5'}; bar(numbers(:,1)) set(gca, 'XTickLabel', labels) rotateXLabels(gca, 45);
Does anyone know how to rotate the axis labels? Thanks
  1 comentario
Colby
Colby el 10 de Mzo. de 2015
Code got jumbled in the copy-paste. sorry
numbers = magic(5)
labels = {'label 1', 'label 2', 'label 3', 'label 4', 'label 5'};
bar(numbers(:,1))
set(gca, 'XTickLabel', labels)
rotateXLabels(gca, 45);

Iniciar sesión para comentar.

Respuesta aceptada

Giorgos Papakonstantinou
Giorgos Papakonstantinou el 10 de Mzo. de 2015
  2 comentarios
Colby
Colby el 10 de Mzo. de 2015
Great, thanks.
Miquel
Miquel el 12 de Sept. de 2017
The question you are linking to is not available anymore: "We might have deleted it because your question did not receive an answer or any other activity in 14 days. We also delete questions if they contain spam, are off topic, are no longer valid for any of our products, or violate the MATLAB Central Terms of Service." Please, answer it :)

Iniciar sesión para comentar.

Más respuestas (1)

Rae.K
Rae.K el 7 de Nov. de 2022

Categorías

Más información sobre Graphics Object Programming 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