text with arrow pointer
显示 更早的评论

i need help with
how to draw an arrow to point in a specific direction
回答(1 个)
Cris LaPierre
2023-7-25
0 个投票
5 个评论
Tasneem Abed
2023-7-25
Cris LaPierre
2023-7-25
编辑:Cris LaPierre
2023-7-25
By default, these are in normalized units (percentage of your x and y range).
There is an example on the linked page that demonstrates how to use it. The first value in x and y correspond to the tail position, and the 2nd values correspond to the head.
Tasneem Abed
2023-7-25
Walter Roberson
2023-7-25
Be careful, the positions for annotation() can only be absolute coordinates or coordinates normalized to the figure. There is no way to specify data units.
There are File Exchange contributions to make it easier to use data units
Here's an example of one such program on the File Exchange
% add an annotation pointing to the 5th data point
x = 0:24;
y = randi(6000,size(x));
plot(x,y)
S = sprintf("A2="+y(5));
xa = [-1 0]+x(5);
ya = [-1000 0]+y(5);
[xaf,yaf] = ds2nfu(xa,ya);
annotation('textarrow', xaf, yaf,'String',S)
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
