How i can flip the y-axis?

778 ビュー (過去 30 日間)
Thiago Petersen
Thiago Petersen 2017 年 1 月 31 日
移動済み: Dyuman Joshi 2025 年 7 月 6 日
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 件のコメント
Abdullah Mohmmed
Abdullah Mohmmed 2020 年 9 月 10 日
移動済み: Dyuman Joshi 2025 年 7 月 6 日
Code maxwell
Sparsh Garg
Sparsh Garg 2021 年 7 月 27 日
移動済み: Dyuman Joshi 2025 年 7 月 6 日
code maxwell??

サインインしてコメントする。

採用された回答

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 件のコメント
Rahmawati Rahmawati
Rahmawati Rahmawati 2018 年 6 月 3 日
it works for my case, Thank you
Star Strider
Star Strider 2018 年 6 月 3 日
My pleasure.

サインインしてコメントする。

その他の回答 (1 件)

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)

カテゴリ

Help Center および File ExchangeSurfaces, Volumes, and Polygons についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by