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 CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by