Define bar plot colors with CData for different data series

20 次查看(过去 30 天)
I have data for three different measurements and I'd like to plot them in a bar graph. This works with the bar command:
s2 = [ na2 , nb2 , nc2 ];
figure;
b1 = bar(pulse2,s2,'hist','FaceColor','flat');
ni2 are vectors with the data points. Now I'd like to define the color for each series with RGB Triplets.
I know that I can access this property with b1.CData, because the FaceColor is set to flat, but I do not know how. How should the line
b1.CData(:,:) = ([0.1600 0.4400 1] [0.9300 0 0] [0.00 0.57 0.00])
Actually look like to have all the bars for series one in the color [0.1600 0.4400 1], all the bars for series two with color [0.9300 0 0] and all the bars for series three with [0.00 0.57 0.00]?
Thank you very much in advance!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by