Changing color of single bars in a bar plot
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello,
The following will give a bar plot consisting of 2 groups of 3 bars:
figure(1),clf
xdata = [1 2];
ydata = [1 2 3; 4 5 6];
hb = bar(xdata,ydata,1);
The following will change the color of the frist bar in each group:
set(hb(1),'facecolor','w')
But I want to change the color of a single bar (e.g., the first bar in the first group). How do I achieve that?
Thanks
댓글 수: 0
답변 (2개)
Dr. Seis
2012년 1월 4일
See Jonathan's answer here: http://www.mathworks.com/matlabcentral/answers/20860-how-to-use-colormap-for-different-bars
댓글 수: 0
ifham khan
2016년 12월 27일
I just want to get different color of bar for each label spend much time but got nothing. need help urgent

댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Bar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!