Hi :) ,
I have problem when I plot a graph. The graph goes from right to left ! while it should go from left to right . That means my X-axis is reversed. When I tick the Reverse box for the X-axis in the axis properties, it goes on the right way ( from left to right ).
But the problem is that when I plot any graph again, it goes from right to left again :( .
How can I make it always goes from left to right !!
Thanks for reading and your help is appreciated ^_^ .
H.MBK

답변 (2개)

Star Strider
Star Strider 2014년 4월 3일

0 개 추천

From the Axis Properties documentation:
set(gca,'XDir','reverse')

댓글 수: 5

Joseph Cheng
Joseph Cheng 2014년 4월 3일
whilst that will work this time however from his question it looks like it is a permanent thing for all things he is trying to plot. Odd since i cannot find a preference or configuration to do such a thing.
Hassan Al-Mubarak
Hassan Al-Mubarak 2014년 4월 3일
Joeph is right . It only work this time :( .
Star Strider
Star Strider 2014년 4월 3일
Please post relevant parts of your code. Posting images or ‘.fig’ files of your plots as they appear and as you would like them may also help. Something is obviously wrong somewhere.
Hassan Al-Mubarak
Hassan Al-Mubarak 2014년 4월 3일
Hi Star Strider , OK (Y) I did :)
Thank you for uploading the plots.
It is plotting correctly, with monotonically-increasing values of Input on the x-axis. If you want the axes reversed, you have to add:
set(gca,'XDir','reverse')
in each plot in which you want them reversed, as I mentioned originally.

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

Dishant Arora
Dishant Arora 2014년 4월 3일

0 개 추천

get(gca,'Xdir') % see what it says, it must be reversed
set(gca,'Xdir','normal') % sets the axis back to normal

댓글 수: 4

Hassan Al-Mubarak
Hassan Al-Mubarak 2014년 4월 3일
it only works this time but the problem back again in other graphs ! as i said in the question :(
Dishant Arora
Dishant Arora 2014년 4월 3일
편집: Dishant Arora 2014년 4월 3일
The way it appears is perfectly right it's not reversed it's normal see x tick values increases from left to right . Your function value decreases as x increases, it is defined like this only. But if you want it reversed, do the following
set(gca, 'Xdir', 'reversed')
Hassan Al-Mubarak
Hassan Al-Mubarak 2014년 4월 3일
편집: Hassan Al-Mubarak 2014년 4월 3일
ahaaaaaaaaaa
its a problem with the code ( it is too long I forgot to change the values order with this new computer >_< , so I thought there is a problem in this computer ) ... Thanks all
I really appreciate your help
god bless you ^_^
Thanks :)
Image Analyst
Image Analyst 2014년 4월 4일
편집: Image Analyst 2014년 4월 4일
Please mark the best Answer as "Accepted". You can only "Accept" one.

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

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2014년 4월 3일

편집:

2014년 4월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by