MATLAB: How to get a stacked bar graph with a single bar

barstacked

Hello,
I am trying to get a single bar using the stacked property:
figure; bar([0.2 0.8], 'stacked')
This does not create a single stacked bar, it creates two bars of height 0.2 and 0.8.
A work-around is:
figure;bar([0.2 0.8; 1 1],'stacked'); set(gca,'xlim',[0.5 1.5])
But this seems like a silly thing to have to do.
Does anyone know why the stacked input doesn't seem to work for a single bar?
Thanks.

Best Answer

One possibility for a workaround:
v = [0.2 0.8];
figure;
bar(sum(v), 'y')
hold on
bar(v(1), 'b')
hold off