MATLAB: Question about YDir, reverse

axes properties

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

Best Answer

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')