Hi when I plot I always get the same color for both bar. They are from different classes. How can I make the color different? Thank you.
1 回表示 (過去 30 日間)
古いコメントを表示
close all
clear
clc
r = [100; 80];
bar(r)
ylabel('Accuracy');
xlabel('Classifier')
%yticks([0 0.2 0.4 0.6 0.8 1])
xticklabels({'Mono', 'Hetero'})

0 件のコメント
採用された回答
William Rose
2022 年 11 月 28 日
@sam,
y=[100 90 70];
b=bar(y,'FaceColor','flat');
%Next line: Each row is the colorspec for one bar
b.CData=[1,0,0;0,1,0;0,0,1];
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!