how to do reverse plotting in MATLAB?
32 ビュー (過去 30 日間)
古いコメントを表示
How to do reverse plotting or reverse function in MATLAB?
1 件のコメント
Adam Danz
2020 年 10 月 26 日
What's that? Could you provide an example of reverse plotting or reverse function?
回答 (1 件)
Shubham Rawat
2020 年 10 月 29 日
Hi Chubeka,
x = linspace(0,10);
y = sin(x);
x = flip(x); % reverse the values of x
plot(x,y)
If you want to reverse the axes then here is an example code which you may use:
ax = gca;
axes(ax)
x = linspace(0,10);
y = sin(x);
plot(x,y)
ax.YDir = 'reverse'; % for reversing the Y direction
ax.XDir = 'reverse'; % for reversing the X direction
1 件のコメント
Elioth Daniel
2023 年 3 月 15 日
The reverse command was very helpful for me. All I wanted was for my plot to start from the higher values to lower values but I was stuck trying to solve this issue for the x axis in an FTIR plot.
Thank you! @Shubham Rawat
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!