How to rotate xaxis labels (bar graph)

28 次查看(过去 30 天)
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 个评论
Colby
Colby 2015-3-10
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);

请先登录,再进行评论。

采纳的回答

Giorgos Papakonstantinou
  2 个评论
Miquel
Miquel 2017-9-12
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 :)

请先登录,再进行评论。

更多回答(1 个)

Rae.K
Rae.K 2022-11-7

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by