Plotting a scatter graph with a categorical X axis

I have a scatter graph as shown above but I want to alter the x axis so that I can have a category for every jump in 10. So basically I would like to replace each interval of 10 with a word or 2 to represent a category

回答 (1 件)

Scott MacKenzie
Scott MacKenzie 2023 年 5 月 3 日

1 投票

Just follow your chart function with code to add tick labels at 5, 15, 25, etc. Something like this should work:
xticks(5:10:55);
xticklabels({'first', 'second', 'third', 'fourth', 'fifth', 'sixth'});

カテゴリ

ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索

製品

リリース

R2022a

タグ

質問済み:

2023 年 5 月 3 日

回答済み:

2023 年 5 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by