How to change color of box with bar function?

조회 수: 1 (최근 30일)
Tung
Tung 2015년 6월 25일
댓글: B.k Sumedha 2015년 6월 25일
Hi all, I am using bar function for my table chart. I want to change 'Attacked' box from blue color to red color. I used findobj function to find 'Attacked' box and set color but it's not working. Anyone have any idea? Thank in advance! Here is my code:
str={'Normal';'Attacked'};
x=[1;2];
y=[142 ;4128 ];
b=bar(x,y,0.3);
set(gca,'xticklabel',str)

채택된 답변

B.k Sumedha
B.k Sumedha 2015년 6월 25일
U can use this.
b=bar(x,diag(y),'stacked');
  댓글 수: 2
Tung
Tung 2015년 6월 25일
it worked. Thank so much!
B.k Sumedha
B.k Sumedha 2015년 6월 25일
Your welcome :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Bar Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by