Finding the location of the axis end in normalized coordinates

22 ビュー (過去 30 日間)
Oskar Gumowski
Oskar Gumowski 2021 年 2 月 4 日
編集済み: Oskar Gumowski 2021 年 2 月 4 日
Hello,
I have a problem with determining the end of the axis in normalized coordinates.
I found the begining of the axes with the function:
ax=axes();
p=get(ax,'Position');
which leads to:
p =
0.1300 0.1100 0.7750 0.8150
Then:
limits=xlim()
limits =
0 1
So I thought that the x-axis is ending at the 1, but after using this function:
annotation('textarrow',[p(1),p(3)],[p(2),p(2)]);
I got this:
As you can see, arrow ends somewhere between 0.8 and 0.9.
I am trying to find the position of the x, y point on the plot in normalized coordinates as I need to automate the annotation insertion on automatically generated graphs.
With best regards

採用された回答

Ive J
Ive J 2021 年 2 月 4 日
編集済み: Ive J 2021 年 2 月 4 日
You just missed the fact that end of axis is starting point + width, try this
ax=axes();
p=get(ax,'Position');
annotation('textarrow',[p(1), p(1) + p(3)],[p(2), p(2)]);

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by