How i can flip the y-axis?

조회 수: 703 (최근 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 CenterFile Exchange에서 Surfaces, Volumes, and Polygons에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by