How to assign color for different column in a group wise bar chart?

1 回表示 (過去 30 日間)
Mr. 206
Mr. 206 2019 年 1 月 14 日
コメント済み: Mr. 206 2019 年 1 月 14 日
I am creating a bar chart of 4 groups of data each containing 3 columns. I want to assign red for highest column and blue for smallest column in each group.
Here is my code.
exp1 = [1 2 3; 4 5 9; 8 1 6; 4 3 8];
figure()
h = bar(exp1);
set(gca,'XTickLabel',{'n-Heptane','O_2','CO','CO_2'});
for k = 1 :size(exp1,2)
h(k).CData = k;
end
And There is a common xTicklabel for each group. How can i name each column along with common group name?
  4 件のコメント
Adam
Adam 2019 年 1 月 14 日
Yes, you can do it with a single bar chart. I even took the time to answer that very question on here last week, but you deleted the question before I posted my answer!
Mr. 206
Mr. 206 2019 年 1 月 14 日
Can't it be extended for Groupwise bar chart?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by