How to plot a histogram with two different bar colours
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a histogram and I want to have two seperate bar colours and then add a legend for both colours.
I have tried different solutions but no luck. Any assistance would be appreciated. My code is below.
I'm extracting data from a table with categorical data. The data is in the 11th column of the table.
My current histogram
BB = T3{:,11}
histogram(BB,'FaceColor','g' )
legend
0 个评论
采纳的回答
Mario Malic
2020-12-6
编辑:Mario Malic
2020-12-6
Hello,
Reference to the answer by Mike is here. If you could display your data with bar function, it is possible to set the color of each individual element with CData property.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!