How to assign a reference point in graph?

1 次查看(过去 30 天)
how to assign reference point(0,0) at left top corner like following figure?

采纳的回答

Walter Roberson
Walter Roberson 2016-4-6
plot(rand(1,30))
set(gca,'YDir', 'reverse')
  3 个评论
Muhammad Usman Saleem
have you check output of this code? @LAKSHMANAN ADAIKKAPPAN
Walter Roberson
Walter Roberson 2016-4-7
编辑:Walter Roberson 2016-4-7
Certainly I have checked the output of the code. If you prefer to see the full 0 to 14 and 0 to 16, change the graph to use that, such as
plot(0:16, 14 * rand(1,17))
and you might want to set the axis location as well,
set(gca, 'ydir', 'reverse', 'xaxislocation', 'top')
This could be taken further to get rid of the tick marks but leave the tick labels. The ease of doing that would depend upon the MATLAB version being used.

请先登录,再进行评论。

更多回答(2 个)

Muhammad Usman Saleem
编辑:Muhammad Usman Saleem 2016-4-6
UPDATE 1:
may try this
plot(1:10)
box off
axes('xlim', [1 10], 'ylim', [1 10], 'color', 'none', 'YAxisLocation', 'right', 'XAxisLocation', 'top')
for reading read here
or may try this
t=0:0.1:10;
y=sin(t);
plot(t,y)
set(gca,'XAxisLocation','top','YAxisLocation','left','ydir','reverse');
  3 个评论
LAKSHMANAN ADAIKKAPPAN
编辑:LAKSHMANAN ADAIKKAPPAN 2016-4-6
Thank you for your guidance sir. It will work.

请先登录,再进行评论。


Steven Lord
Steven Lord 2016-4-6
plot(1:10, 1:10);
axis ij
Or if you have the handle of your axes object already, change its YDir property to 'reverse' as Walter showed.

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by