How to have qualitative expressions in 'x' axis plot in MATLAB?
조회 수: 2 (최근 30일)
이전 댓글 표시
Dear scholars,
I was wodering if there is any way that I can write qualitative phrases (e.g. XXXX) in x axis in a plot instead of numerical values.
댓글 수: 0
답변 (1개)
Ameer Hamza
2020년 9월 22일
Yes. Use XTickLabel property of the axes object. For example
ax = axes();
plot(0:10, rand(1,11));
ax.XTick = [0 5 10];
ax.XTickLabel = {'Zero', 'Five', 'ten'};
댓글 수: 1
Steven Lord
2020년 9월 22일
You could also use the xticks and xticklabels functions.
>> plot(1:10);
>> xticks(1:3:10);
>> xticklabels(["one", "four", "seven", "ten"])
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!