Azzera filtri
Azzera filtri

Bar graph in RGB Colors

17 visualizzazioni (ultimi 30 giorni)
Ferdinand
Ferdinand il 9 Ott 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

Risposte (2)

Walter Roberson
Walter Roberson il 9 Ott 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 il 9 Ott 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;

Categorie

Scopri di più su Graphics Object Properties in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by