Define bar plot colors with CData for different data series

조회 수: 21 (최근 30일)
ID#
ID# 2018년 10월 20일
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