Bar graph in RGB Colors

17 次查看(过去 30 天)
Ferdinand
Ferdinand 2012-10-9
Hi,
I would like to plot a bar graph in rgb-colors ('Color',[R G B]). I tried to do it the normal way handle=bar(y,x,'Color',[R G B]) and by set(handle,'Color',[R G B]) but it didn't work out.
Could anyone help me on this one? =)
Greetings from Germany!
Ferdinand

回答(2 个)

Walter Roberson
Walter Roberson 2012-10-9
bar() plots in modern MATLAB create a barseries object. The barseries object has a series of Children, each of which is a patch object, with the color of the patch object being controlled by its CData property. Each patch object represents one original column in y (in the multi-column case).
However, user testing has found that if there are 1000 or more columns that instead of individual patches, a single patch object is created with all of the data.

Image Analyst
Image Analyst 2012-10-9
Try 'FaceColor' instead of 'Color':
x = 30:40;
y = rand(length(x),1);
bar(x,y, 'FaceColor', [.42 .37 .73]); % Values in the 0-1 range for FaceColor
grid on;

类别

Help CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by