MATLAB: How to change plot from Descending to Ascending

arraygraphMATLABmatrixmatrix arrayplotplottingsubplot

If I have
plot(k,gpa,'r+:',finalArray2,finalArray1);
which forms a descending plot, what can I change to make it an ascending plot?

Best Answer

Maybe something like using sort() to sort your data,
[gpa, sortOrder] = sort(gpa, 'descend');
k = k(sortOrder); % Sort k the same way.
or setting the xdirection to reverse:
ax = gca
ax.YDir = 'reverse';