writing the bar chart value

1 回表示 (過去 30 日間)
Lilya
Lilya 2016 年 2 月 13 日
コメント済み: Lilya 2016 年 2 月 13 日
Hi all,
the following chart describes the problem in displaying the bar value why does it not appear as a single value for each one?
thank you for help
  2 件のコメント
Star Strider
Star Strider 2016 年 2 月 13 日
What code did you write to create it?
Lilya
Lilya 2016 年 2 月 13 日
編集済み: dpb 2016 年 2 月 13 日
y = [R2_Plm; R2_Tlm; R2_Txlm; R2_Tylm; R2_Wlm; R2_PTlm]';
x=1:6;
bar(y,0.4)
ylim([0 1.2])
Labels = {'P', 'T', 'Tx', 'Ty','Txy', 'P and T'};
set(gca, 'XTick', x, 'XTickLabel', Labels);
text(x',y',num2str(y),...
'HorizontalAlignment','center','VerticalAlignment','bottom')

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

採用された回答

Image Analyst
Image Analyst 2016 年 2 月 13 日
You need to do each label one at a time. Use this:
bar(y,0.4)
ylim([0 1.2])
Labels = {'P', 'T', 'Tx', 'Ty','Txy', 'P and T'};
set(gca, 'XTick', x, 'XTickLabel', Labels);
for k = 1 : length(x)
text(x(k)',y(k)',num2str(y(k)),...
'HorizontalAlignment','center','VerticalAlignment','bottom')
end
grid on;
  1 件のコメント
Lilya
Lilya 2016 年 2 月 13 日
Thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by