anyway to give separate color to 'stack' bar plot

1 ビュー (過去 30 日間)
Yu Li
Yu Li 2019 年 10 月 16 日
コメント済み: Yu Li 2019 年 10 月 16 日
Hi:
I read an post from link below:
which provide a way to add annotation to the individual of each data. I would like to know if there is anyway to control the color of each individual bar?
untitled.jpg
Thanks!
Yu

回答 (1 件)

darova
darova 2019 年 10 月 16 日
編集済み: darova 2019 年 10 月 16 日
Do you have colors you want to paint bars into?
for i = 1:length(hBar)
h1 = get(hBar(i),'Children');
n = length( get(h1,'FaceVertexCdata') );
set(h1,'faceVertexCdata',rand(n,3))
end
  5 件のコメント
Yu Li
Yu Li 2019 年 10 月 16 日
Hi:
yes, 'faceColor' works but it is only single color. I need to change all the colors.
Thanks!
Yu

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

カテゴリ

Find more on Discrete Data Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by