Filter löschen
Filter löschen

Bar graph in RGB Colors

17 Ansichten (letzte 30 Tage)
Ferdinand
Ferdinand am 9 Okt. 2012
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

Antworten (2)

Walter Roberson
Walter Roberson am 9 Okt. 2012
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 am 9 Okt. 2012
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;

Kategorien

Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by