フィルターのクリア

How can I get the extent (bounding box) of the legend on a plot?

6 ビュー (過去 30 日間)
RonE
RonE 2021 年 1 月 11 日
コメント済み: Mario Malic 2021 年 1 月 11 日
How can I get the extent (bounding box) of the legend on a plot? For example, can get the extent of a text label like this:
h = text(x, y, "hello");
extent = get(h, 'extent');
I am trying to place text labels where they do not overlap with objects on the plot.
Thanks
Ron
  3 件のコメント
RonE
RonE 2021 年 1 月 11 日
編集済み: RonE 2021 年 1 月 11 日
Ok thank you, the next question would be "how does that position relate to the plot coordinates?" Position returns [0.8158 0.4488 0.0862 0.1373]. My x axis range is 0-87. If I multiply 0.8158 * 87 = 70.97, but the left edge of my legend is at about 77.
Mario Malic
Mario Malic 2021 年 1 月 11 日
These numbers are relative to the axes parent frame. Last two numbers of legend's position property denote width and height relative to the axes border. First two being the distance between bottom-left corner of axes and bottom-left starting point of legend.
To get the coordinates, multiply the appropriate position properties of axes and legend.

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

回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by