How to adjust color of each bar in a grouped bar plot?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Following is my code, two bars in each group of bars, I want to fix the colors e.g., blue and yellow of two bars in each gropu. How I can chnage this code? FT in blue and AK in yellow?
data = [F_CRPS_ip A_CRPS_ip; F_CRPS_is A_CRPS_is; F_CRPS_rho A_CRPS_rho];
y = data;
x = ["I_P" "I_S" "Rho"];
figure(); b = bar(x,y);
xlabel('Predictions');
ylabel('Mean CRPS');
set(b, {'DisplayName'}, {'FT','AK'}');
legend()
0 commentaires
Réponse acceptée
Voss
le 3 Mar 2024
Modifié(e) : Voss
le 3 Mar 2024
% data = [F_CRPS_ip A_CRPS_ip; F_CRPS_is A_CRPS_is; F_CRPS_rho A_CRPS_rho];
data = rand(3,2);
y = data;
x = ["I_P" "I_S" "Rho"];
figure();
b = bar(x,y);
b(1).FaceColor = [0 0 1]; % RGB blue
b(2).FaceColor = [1 1 0]; % RGB yellow
xlabel('Predictions');
ylabel('Mean CRPS');
set(b, {'DisplayName'}, {'FT','AK'}');
legend()
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Histograms 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!