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 27 28
| X = round(rand(17)*15);
figure
h = bar3(X,1);
for n=1:numel(h)
% Centrage des valeurs en (0,0)
x = get(h(n),'xdata');
x = x-ceil(size(X,2)/2);
y = get(h(n),'ydata');
y = y-ceil(size(X,1)/2);
% Modification de la couleur des barres en fonction de la valeur Z
cdata=get(h(n),'zdata');
cdata=repmat(max(cdata,[],2),1,4);
set(h(n),'cdata',cdata,'facecolor','flat','xdata',x,'ydata',y);
end
axis tight
xt = get(gca,'xtick');
yt = get(gca,'ytick');
set(gca,'xticklabel',num2str(xt(:)*1.2625),'yticklabel',num2str(yt(:)*1.2625)) |
Partager