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 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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'})
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1210263/image.png)
0 commentaires
Réponse acceptée
William Rose
le 28 Nov 2022
@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];
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!