MATLAB Answers

change the color of bar

1 view (last 30 days)
Hassan
Hassan on 30 Dec 2011
*I want to assign a secific color to each column ('r','g' and 'b'). I also want to show the bars as grouped. Any suggestion please? *
y=rand(9,3)
bar(y)

Answers (1)

Grzegorz Knor
Grzegorz Knor on 30 Dec 2011
  2 Comments
Hassan
Hassan on 30 Dec 2011
bar(y(:,1),'r')
hold on
bar(y(:,2),'g')
hold on
bar(y(:,3),'b')

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!