フィルターのクリア

how to write the legend in bar chart

2 ビュー (過去 30 日間)
Ibrahim AlZoubi
Ibrahim AlZoubi 2020 年 5 月 3 日
コメント済み: Ibrahim AlZoubi 2020 年 5 月 3 日
how to add legend for the first, second and third column?
this is the code:
y =[44,55,54] ;
b = bar(y,0.5);
bar(y)

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 5 月 3 日
編集済み: Ameer Hamza 2020 年 5 月 3 日
Try this
y =[44,55,54];
hold on
for i=1:numel(y)
bar(i, y(i))
end
legend({'first', 'second', 'third'})
  14 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 5 月 3 日
You can replace A, B and C with what you want
y =[44,55,54];
hold on
for i=1:numel(y)
bar(i, y(i))
end
xticks(1:numel(y))
xticklabels({'44', '55', '54'})
legend({'first', 'second', 'third'})
Ibrahim AlZoubi
Ibrahim AlZoubi 2020 年 5 月 3 日
thank you sir it worked thank you!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by