change the color of bar

1 次查看(过去 30 天)
Hassan
Hassan 2011-12-30
*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)

回答(1 个)

Grzegorz Knor
Grzegorz Knor 2011-12-30
  2 个评论
Hassan
Hassan 2011-12-30
thanks for the comment. i forgot to mention i want the bars as grouped.
Hassan
Hassan 2011-12-30
bar(y(:,1),'r')
hold on
bar(y(:,2),'g')
hold on
bar(y(:,3),'b')

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by