How to change the colours of bars in a histogram with multiple data
33 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
yousra boukaissi
am 6 Jun. 2022
Kommentiert: Bjorn Gustavsson
am 7 Jun. 2022
I have two Data sets re_hight and re_low. I made a distribution of both sets withing the same diagram. How can i chage the default colours to red and blue?
the code for the plot is:
hist([re_low re_high],[-2:2:182]);
xlim([-2 82]);
0 Kommentare
Akzeptierte Antwort
Bjorn Gustavsson
am 6 Jun. 2022
If you take the output from hist and plot that with bar, you can do something like this:
[phH1,phH2] = hist([re_low' re_high'],[-2:2:182]);
bh = bar(phH2,phH1);
set(bh(1),'FaceColor','b')
set(bh(2),'FaceColor','r')
HTH
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!