I want to change the colors of my stacked bar plot but I keep getting an error message
As I need specific colors in my stacked bar plot to match with another graph I set up the color vector: colori with RGB values which I then convert into values between 0 and 1 after creating the figuer I want to change colors of the 15 stacked bars like this:
for i = 1:15
barSNE(i,:).FaceColor = colori(i);
end
here a bit mor of the code:
...
colori = [139,0,0
255,160,122;
255,69,0;
255,165,0;
255,215,0;
154,205,50;
34,139,34;
50,205,50;
255,182,193;
106,90,205;
139,0,139;
32,178,170;
199,21,133;
30,144,255;
0,0,205];
colori = colori ./ 255;
ctMeansT = ctMeans.';
figure(2)
barSNE = bar(ctMeansT, 'stacked');
for i = 1:15
barSNE(i,:).FaceColor = colori(i);
end
However, I get following Error message:
Structure assignment to non-structure object. Error in viSNE_stacked_bar_plot (line 41) barSNE(i,:).FaceColor = colori(i);
Colors in the figuere are not changed as expected
