How to change plot from Descending to Ascending
11 views (last 30 days)
Show older comments
If I have
plot(k,gpa,'r+:',finalArray2,finalArray1);
which forms a descending plot, what can I change to make it an ascending plot?
Accepted Answer
Image Analyst
on 16 Oct 2018
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';
0 Comments
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!