How to rotate xaxis labels (bar graph)

조회 수: 16 (최근 30일)
Colby
Colby 2015년 3월 10일
답변: Rae.K 2022년 11월 7일
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
Giorgos Papakonstantinou 2015년 3월 10일
  댓글 수: 2
Colby
Colby 2015년 3월 10일
Great, thanks.
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에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by