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 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!