How i can flip the y-axis?
703 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Thiago Petersen
am 31 Jan. 2017
Verschoben: Dyuman Joshi
am 6 Jul. 2025
Hello,
In the following code:
a = [180 170 150 90 45 5 0 -5 -30 -70 -100 -125 -150 -175];
b = [1 2 3 4 5 6 7 8 9 10 11 12 13 14];
plot (a, b,'.')
How i can plot the b variable (as the y-axis) with the high numbers down and the low numbers up in the plot?
Thanks
2 Kommentare
Akzeptierte Antwort
Star Strider
am 31 Jan. 2017
After your plot call, add this line:
set(gca, 'YDir','reverse')
2 Kommentare
Weitere Antworten (1)
Stalin Samuel
am 31 Jan. 2017
Bearbeitet: Stalin Samuel
am 31 Jan. 2017
If you planning to change the ylabel use
set(gca,'YtickLabel',14:-2:0)
Or else, if you wants to flip b alone you can use
fliplr(b)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surfaces, Volumes, and Polygons finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!