anyway to give separate color to 'stack' bar plot
2 次查看(过去 30 天)
显示 更早的评论
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?
Thanks!
Yu
0 个评论
回答(1 个)
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 个评论
darova
2019-10-16
I have v2013. Which face will change if you try this
hBar(1).FaceColor = [1 0 0];
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!