How to plot a histogram with two different bar colours
조회 수: 6 (최근 30일)
이전 댓글 표시
Emmanuel Matata Bili Bili
2020년 12월 6일
댓글: Emmanuel Matata Bili Bili
2020년 12월 9일
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!