get the values of the axis of a plot

89 ビュー (過去 30 日間)
Luca cadalo
Luca cadalo 2017 年 3 月 9 日
回答済み: Star Strider 2017 年 3 月 9 日
I have created a plot and I want to know if there is a command to get the value of the x axis of the plot because I want to draw an horizontal line just as long as the x axis
thanks

採用された回答

Star Strider
Star Strider 2017 年 3 月 9 日
You can get the limits of the x-axis with:
XL = get(gca, 'XLim');
To plot a horizontal line the length of the x-axis:
plot(XL, [1 1]*val)
where ‘val’ is the y-value of the line.
You can get the values of the x-ticks with:
XT = get(gca, 'XTick');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by