필터 지우기
필터 지우기

plots with xlabel too long of a string for the plot

조회 수: 1 (최근 30일)
Adam Jurhs
Adam Jurhs 2022년 5월 10일
댓글: Rik 2022년 5월 10일
hi,
i need to make a plot that has doubles for the y-axis and strings for the x-axis
1,'abc'
2,'def'
3,'ghi'
4,'jkl'
5,'mno'
...
i've been plotting using the index as the x-axis and using xlabel ('abc def ghi jkl mno ...') to give them a name. the problem is that the strings don't line up with the index and the length when plotted have gotten longer than the size of the plot. i'm thinking i could rotate the strings at a 45* angle, but i don't know how to do that). hints?

채택된 답변

Prakash S R
Prakash S R 2022년 5월 10일
편집: Prakash S R 2022년 5월 10일
set(gca, 'XTickLabels', {'abc' 'def' 'ghi' 'jkl' 'mno' ..}) ;
xtickangle(45)

추가 답변 (1개)

Adam Jurhs
Adam Jurhs 2022년 5월 10일
awesome, thanks! worked perfectly
  댓글 수: 2
Prakash S R
Prakash S R 2022년 5월 10일
Awesome! Please "Accept" the response that was helpful, if you could :)
Rik
Rik 2022년 5월 10일
You also posted this as a comment. Feel free to delete it and repost it as a comment.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by