How to flip a line upside down?
6 ビュー (過去 30 日間)
古いコメントを表示
How can I flip this line upside down:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160336/image.png)
This is my code that may not need flipud() :
x = [1 2 3];
y = [2 2.5 3.5];
flipud(plot(x,y))
3 件のコメント
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
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 件のコメント
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 Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!