How to change color of box with bar function?

4 次查看(过去 30 天)
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');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by