How to add more names on a plot axis

3 ビュー (過去 30 日間)
Siskia Yarzagaray
Siskia Yarzagaray 2016 年 5 月 15 日
コメント済み: Siskia Yarzagaray 2016 年 5 月 16 日
As shown in the graph below, I have edited to X-axis to include names. At the moment it only shows 6 names. How do I increase the number of names that may be shown on the X-axis? To be a bit more specific, each bar should show its own name underneath it.
I've made use of the folowing code in order to edit the axis.
%
ax = gca;
set(ax, 'XTickLabel', y, 'XMinorTick','on'); %Change the YtickLabels to course code.
ax.XTickLabelRotation = 90;

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 5 月 15 日
編集済み: Azzi Abdelmalek 2016 年 5 月 15 日
Look at this example
x=1:20
y=randi(10,1,numel(x))
bar(x,y)
n=numel(y)
names=strsplit(sprintf('name%d ',1:n))
ax = gca;
ax.XTick=x
set(ax, 'XTickLabel', names, 'XMinorTick','on');
ax.XTickLabelRotation = 90;
  1 件のコメント
Siskia Yarzagaray
Siskia Yarzagaray 2016 年 5 月 16 日
Works perfectly. Thank you very much :D

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by