필터 지우기
필터 지우기

How to flip a line upside down?

조회 수: 6 (최근 30일)
Ezz El-din Abdullah
Ezz El-din Abdullah 2017년 2월 2일
댓글: Adam 2017년 2월 2일
How can I flip this line upside down:
This is my code that may not need flipud() :
x = [1 2 3];
y = [2 2.5 3.5];
flipud(plot(x,y))
  댓글 수: 3
Ezz El-din Abdullah
Ezz El-din Abdullah 2017년 2월 2일
Why is the 'line' a scalar object not an array?
Adam
Adam 2017년 2월 2일
편집: Adam 2017년 2월 2일
Because it is a line object. There is only one line. Of course, it depends what version of Matlab you are using. If you are < R2014b then it will simply be a 'magic' double which you can query for the line properties.
Take a look at the output of
h = plot( x, y )
on the command line and you will see what it is. It is an object containing many useful properties of the line - e.g. colour, width, x data, y data

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

채택된 답변

Adam
Adam 2017년 2월 2일
편집: Adam 2017년 2월 2일
figure; hAxes = gca;
x = [1 2 3];
y = [2 2.5 3.5];
plot( hAxes, x, y )
set( hAxes, 'YDir', 'reverse' ) % Or hAxes.YDir = 'reverse' from R2014b onwards
  댓글 수: 4
Ezz El-din Abdullah
Ezz El-din Abdullah 2017년 2월 2일
I mean it's like considering the image a paper and I would like to flip it over upside down so that e.g. the point at y=20 will be at y=70 and so on.
Is it clear now?
Adam
Adam 2017년 2월 2일
Then you probably want the above maths or something similar. If you want 20 to become 70 then just substitute 70 and 20 in instead of max( data ) and min( data )

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by