How can I plot a legend in a bar plot in Matlab? Here is the code:
Y = [1.5056 0.72983 3.4530 3.2900 1.4839 12.9 ]; n = length(Y); h = bar(Y); colormap(summer(n)
Further to bla's answer, you can use
h = bar(diag(Y),'stacked');
if you want to avoid the displacement.