How i can flip the y-axis?

2,036 次查看(过去 30 天)
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

采纳的回答

Star Strider
Star Strider 2017-1-31
After your plot call, add this line:
set(gca, 'YDir','reverse')
See the documentation for Axes Properties for details.

更多回答(2 个)

Stalin Samuel
Stalin Samuel 2017-1-31
编辑:Stalin Samuel 2017-1-31
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)

Abdullah Mohmmed
Abdullah Mohmmed 2020-9-10
Code maxwell

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by