Question about YDir, reverse

86 ビュー (過去 30 日間)
mathScience
mathScience 2015 年 2 月 17 日
コメント済み: mathScience 2015 年 2 月 17 日
Hello all,
I was trying to draw the plot and reverse the Y direction of the plot with following code:
P = plot(x, y)
set(P, 'YDir', 'reverse');
However, the matlab command says that
Error using
matlab.graphics.chart.primitive.Line/set
There is no YDir property on the Line class.
Then if I click matlab.graphics.chart.primitive.Line/set, it says
There is no documentation for matlab.graphics.chart.primitive.Line/set
What should I do? Any help will be appreciated.
Thank you

採用された回答

Stephen23
Stephen23 2015 年 2 月 17 日
編集済み: Stephen23 2015 年 2 月 17 日
You can read all of the chartline Properties , and there is no mention of reverse anywhere on the page.
Perhaps you were thinking of the axes Properties , which has the option 'reverse' for any of XDir, YDir, and ZDir. Exactly how you do this depends on your code, but you could try this for a start:
set(gca,'YDir','reverse')
  1 件のコメント
mathScience
mathScience 2015 年 2 月 17 日
Thank you!

サインインしてコメントする。

その他の回答 (1 件)

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2015 年 2 月 17 日
編集済み: Giorgos Papakonstantinou 2015 年 2 月 17 日
It should be
set(gca, 'Ydir', 'reverse')
The plot as mentioned above does not have a property Ydir. However, the axes which the plot belongs to has this property.
  1 件のコメント
mathScience
mathScience 2015 年 2 月 17 日
Thank you! it works!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by