I am trying to make a stratigraphic column using the bar function with the stacked option enabled and I am running into an issue with the bar function changing the order that the bars are stacked relative to the order they are in the variable that stores them.
For example, I want to make a stacked bar plot with the following thicknesses with the following code:
x = [582.17 960.12-582.17 971.09-960.12]';
N = size(x, 1);
elv = 1233.526;
bar([x(:,1)' ; NaN(1,N)],'stacked','facecolor','flat', 'BaseValue', elv);
xlim([0.25 1.75]);
ylabel('Elevation (m)');
grid minor;
legend('Rock 1','Rock 2','Rock 3');
However, as shown in the figure, when I run this code, the bars get stacked in the order of Rock 1, Rock 3, Rock 2 when they should be stacked in the order of Rock 1, Rock 2, Rock 3.