Display specific values in x-axis

2 ビュー (過去 30 日間)
Haythem Zouabi
Haythem Zouabi 2020 年 1 月 20 日
コメント済み: Haythem Zouabi 2020 年 1 月 20 日
Hello,
I would like to display specific values in x-axis but it doesn't work.
This is my code:
X = categorical({'16s','20s','30s'});
X = reordercats(X,{'16s','20s','30s'});
MIG16s=[8.81, 7.68, 5.20]
MIG20s=[9.65, 7.92, 4.61]
MIG30s=[9.52, 7.86, 4.84]
MIG=[MIG16s; MIG20s; MIG30s]
y=MIG
b = bar(X, y)
hBar = bar(y,1);
for k1 = 1:size(y,2)
ctr(k1,:) = bsxfun(@plus, hBar(1).XData, hBar(k1).XOffset'); % Note: ‘XOffset’ Is An Undocumented Feature, This Selects The ‘bar’ Centres
ydt(k1,:) = hBar(k1).YData; % Individual Bar Heights
text(ctr(k1,:), ydt(k1,:), sprintfc('%.2f', ydt(k1,:)), 'HorizontalAlignment','center', 'VerticalAlignment','bottom', 'FontSize',8, 'Color','b')
end
legend({'X10', 'X20', 'X50'});
set(gcf,'color','w') % pour les bordures.
set(gca, 'FontSize', 9, 'linewidth', 1, 'FontName','Times New Roman'); %la taille des éléments sur les axes.
xlabel('Grandissement','FontSize',12, 'FontName','Times New Roman')
ylabel('MIG','FontSize',12, 'FontName','Times New Roman')
Do you have answer?
Thanks,
  2 件のコメント
Adam Danz
Adam Danz 2020 年 1 月 20 日
What isn't working?
I don't see any part of your code that specifies x axis values.
Haythem Zouabi
Haythem Zouabi 2020 年 1 月 20 日
The problem is that I can't obtain 16s, 20s and 30s in x-axis.
Thank you,

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by