Hi. I have the following script (attached )b and the run that it opens can be found at this link.
https://drive.google.com/open?id=0B0wQbicZOF7xN1BXV1FKVVRCT2c
It works perfectly except I want to reverse the the y- axis. I have tried several things but no luck. The only way I found is to do it manually. Is there another way?

 채택된 답변

Adam
Adam 2017년 3월 28일

0 개 추천

set( hAxes, 'YDir', 'reverse' )
should do this for an axes hAxes.

댓글 수: 3

David du Preez
David du Preez 2017년 3월 28일
I've tried that. It doesn't work
set (gca,'YDir','reverse')
In second last line
Adam
Adam 2017년 3월 28일
So is it working or not now? You accepted an answer so I assume so, but your comment suggests otherwise.
As I mentioned, hAxes is an axes handle, how you get this is up to you. I would never use 'gca' except in a temporary script though, you should keep a handle to your axes and use this explicitly.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

KSSV
KSSV 2017년 3월 28일

2 개 추천

N = 10 ;
x = rand(N,1) ;
y = 1:N ;
figure(1)
plot(x,y) ;
figure(2)
plot(x,y) ;
set(gca,'Ydir','reverse')

댓글 수: 5

David du Preez
David du Preez 2017년 3월 28일
I've tried that. It doesn't work
Timothy Buchanan
Timothy Buchanan 2019년 8월 7일
It worked for me.
Helene Thygesen
Helene Thygesen 2020년 11월 10일
it worked for me too
Ruslan Askarov
Ruslan Askarov 2023년 5월 26일
it worked for me too. Thanks a lot!
Jahanzeb Saqib
Jahanzeb Saqib 2023년 6월 8일
Its working for me as well even with barh plot... Many thanks!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2017년 3월 28일

댓글:

2023년 6월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by