Hi all,
Im wondering to plot a bar figure with 6*2=12 bars, coupled by pairs. As it is said, a picture is worth a thousand words, so I'll paste you my code and the results I get, and then I'll show you a figure treated to get the results I want.
First, the code:
h=figure();bar(A,[X Y Z F G H],'stacked');legend('X','Y','Z','F','G','H');grid on;xlabel('A');ylabel('B');
where X, Y, Z, F, G, H and A are 6×1 arrays.
And the result are this:
However, the wondered result would look more like the image below. This figure has been done from the previous one.
I have tried to build a 3 dimensional matrix with cat(3,A,A) and cat(3,[X Y Z],[F G H]), but this is not accepted by bar. I have also tried to use hold on like:
h=figure();bar(A,[X Y Z],'stacked');hold on;bar(A,[F G H],'stacked');legend('X','Y','Z','F','G','H');grid on;xlabel('A');ylabel('B');
But the results still not the wondered:
Anybody has any help?
Best Answer