The annotation('textarrow',...) does not go out of a plot
9 次查看(过去 30 天)
显示 更早的评论
How to place an annotation('textarrow',...) out of a plot?
hf = figure;
ax = subplot(3,3,5);
hold on
scatter(0:3,0:3,[],'filled','Clipping', 'off')
plot(0:3,0:3,'Clipping', 'off')
hold off
axis equal
axis(ax, [0 2 0 2]);
% My attempt
% Reference: https://ch.mathworks.com/matlabcentral/answers/310815-specify-annotation-position-with-respect-to-x-and-y-axes-values
ha = annotation('textarrow','String','arrow text');
ha.Parent = hf.CurrentAxes;
ha.X = [-2 1];
ha.Y = [1 0];
By using these coordinates:
ha.X = [-2 1];
ha.Y = [1 0];
we can see that the arrow does not go out of the plot. How to show the entire arrow ?
0 个评论
采纳的回答
Sim
2023-5-30
2 个评论
VBBV
2023-5-30
try the x, y coordinates argument for annotation
hf = figure;
ax = subplot(3,3,5);
hold on
scatter(0:3,0:3,[],'filled','Clipping', 'off')
plot(0:3,0:3,'Clipping', 'off')
hold off
axis equal
axis(ax, [0 2 0 2]);
% My attempt
% Reference: https://ch.mathworks.com/matlabcentral/answers/310815-specify-annotation-position-with-respect-to-x-and-y-axes-values
x = [0.3 0.5];
y = [0.9 0.5];
ha = annotation('textarrow',x,y,'String','arrow text');
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!