1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| figure(3);
hmt = bar(VectorPercentTime_masse_reduit);
nn = size(VectorPercentTime_masse_reduit);
n = nn(1,2);
ch = get(hmt,'Children');
fvd = get(ch,'Faces');
fvcd = get(ch,'FaceVertexCData');
[zs, izs] = sortrows(VectorPercentTime_masse_reduit',1);
k = 128; % Number of colors in color table
colormap(summer(k)); % Expand the previous colormap
shading interp % Needed to graduate colors
for i = 1:n
color = floor(k*i/n); % Interpolate a color index
row = izs(i); % Look up actual row # in data
fvcd(fvd(row,1)) = 1; % Color base vertices 1st index
fvcd(fvd(row,4)) = 1;
fvcd(fvd(row,2)) = color; % Assign top vertices color
fvcd(fvd(row,3)) = color;
end
set(ch,'FaceVertexCData', fvcd); % Apply the vertex coloring
set(ch,'EdgeColor','k'); % Give bars black borders |
Partager