Problem with plotting a 2D graph

1 回表示 (過去 30 日間)
Hassan Al-Mubarak
Hassan Al-Mubarak 2014 年 4 月 3 日
編集済み: Image Analyst 2014 年 4 月 4 日
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 日
From the Axis Properties documentation:
set(gca,'XDir','reverse')
  5 件のコメント
Hassan Al-Mubarak
Hassan Al-Mubarak 2014 年 4 月 3 日
Hi Star Strider , OK (Y) I did :)
Star Strider
Star Strider 2014 年 4 月 3 日
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 日
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 日
編集済み: 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.

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

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by