How to change color of box with bar function?

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 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

質問済み:

2015 年 6 月 25 日

コメント済み:

2015 年 6 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by