how to flip the direction of the axis?

조회 수: 1,222 (최근 30일)
Lilya
Lilya 2018년 10월 28일
편집: DGM 2024년 2월 11일
Dear all,
I want to change the x-axis direction from right to left but also keeping the values to be not affected (reversed/flipped). when I used the fooling command the mentioned problem is caused:
set(gca, 'XDir','reverse')
How can I solve that?
thanks

채택된 답변

madhan ravi
madhan ravi 2018년 10월 28일
xticklabels([1:10]) %an example
set ( gca, 'xdir', 'reverse' )
  댓글 수: 2
madhan ravi
madhan ravi 2018년 10월 28일
It’s 'xdir' not 'XDir'
DGM
DGM 2024년 2월 11일
편집: DGM 2024년 2월 11일
From @Matthew Stengrim's flag-as-comment:
"incorrect"
While that's a valid point, please use comments and try to explain what you mean to readers instead of just sniping with unhelpful single-word comments.
set() and get() are case-insensitive:
xticklabels([1:10]) %an example
set ( gca, 'XDir', 'reverse' ) % set still works
% see also:
get(gca,'XDir') % the actual case of the property name
ans = 'reverse'
get(gca,'xdir') % lower case
ans = 'reverse'
get(gca,'xdIR') % goofy case
ans = 'reverse'
% case does matter if you directly use dot indexing on the axes object
hax = gca;
hax.XDir % there is an XDir property
ans = 'reverse'
hax.xdir % but there is no xdir property
Unrecognized method, property, or field 'xdir' for class 'matlab.graphics.axis.Axes'.
As to what the nuances of OP's actual problem were, I can't know.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axes Appearance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by