Thanks for your replies!
Do you understand what actually happens when I sort the array Y-axis? Oh maybe I actually get it now, is it like this:
Before sorting Y:
y0 values: a, b, c, d, e, f
y1 values: 1, 2, 3, 4, 5
y2 values: 6, 7, 8, 9, 10
After Sorting Y:
y0 values: 1, 2, 3, 4, 5
y1 values: 6, 7, 8, 9, 10
y2 values: a, b, c, d, e, f
In other words, is the sorting vertical? Is there no way to sort the Y-axis horizontally?