필터 지우기
필터 지우기

Adding label to axis ticks

조회 수: 2 (최근 30일)
Yi-xiao Liu
Yi-xiao Liu 2020년 9월 30일
댓글: Yi-xiao Liu 2020년 10월 2일
How do I add labels next to the 3 180 xticks? Like sampleA for the first one, sampleB for the second, etc. Thanks!
>> xt = xticks
xt =
Columns 1 through 5
0 180 360 450 630
Columns 6 through 9
810 900 1080 1260
>> xtl=xticklabels
xtl =
9×1 cell array
{'0' }
{'180'}
{'360'}
{'0' }
{'180'}
{'360'}
{'0' }
{'180'}
{'360'}

채택된 답변

Adam Danz
Adam Danz 2020년 9월 30일
편집: Adam Danz 2020년 10월 1일
Set the XTickLabel propery of the axis. Use newline to break apart a string into multiple lines.
Quick demo:
ax = cla();
ax.XLim = [0,4];
ax.XTick = 1:3;
ax.XTickLabel{2} = '180\newline A';
"\newline" inserts a line break within the label.
  댓글 수: 1
Yi-xiao Liu
Yi-xiao Liu 2020년 10월 2일
Yep this works. Thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by