How do I position annotations in a figure with respect to the axes in MATLAB 7.2 (R2006a)?

13 次查看(过去 30 天)
When I place certain types of annotations using the ANNOTATION function, they are positioned relative to the figure rather than the axes. This is unexpected since I plotted the data relative to axis x and y rather than to the normalized position within a figure.

采纳的回答

MathWorks Support Team
Some annotations created with the ANNOTATION function are positioned relative to the figure coordinate space rather that the axes coordinate space. These include arrow, doublearrow, textarrow, and ellipse.
You can use the attached function named "axxy2figxy.m" to transform coordinates from data (axes) space to figure space. After downloading the attached function, use the following code to illustrate its use:
figure,line
[axx axy] = ginput(2); % click 2 separate places within the axes.
[figx figy] = axxy2figxy(gca, axx, axy);
har = annotation('textarrow',figx,figy);
  2 个评论
Adam Danz
Adam Danz 2020-4-30
The annotation function needs to have a data-units option. The need to plot in figure units is relatively infrequent and it greatly limits the utility of the otherwise useful annotation() function.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by