Is it possible to annotate arrows (or other annotation objects) in subplots?
17 次查看(过去 30 天)
显示 更早的评论
I want to draw an arrow in one of my subplots at a specific point to mark a zero-crossing. But after I have converted the x and y positions from data space coordiantes to normalized figure space coordinates the arrow is displayed in the figure itself and not inside the subplot were I want it. It seems like MATLAB will only accept a figure handle and not an axis handle for the annotation command. Can anyone tell me wether it is possible at all to draw arrows in a subplot??? Is there an alternative option (other than Paint)??
I've simplified my code to:
subplot(4,2,5);
hold on
plot([xlim(1) xlim(2)],[0 0],'Color',[0.9 0.9 0.9])
plot(xvalues,yvalues)
xlim([xlim(1) xlim(2)])
% Transforming x and y values from data space to figure space
axlim = axis(gca);
arrowx = ([zero-cross zero-cross]-axlim(1))./(axlim(2)-axlim(1));
arrowy = ([-0.1 0]-axlim(3))./(axlim(4)-axlim(3));
% Plotting the arrow
annotation('arrow',arrowx,arrowy);
Thanks, Sabrina
0 个评论
采纳的回答
Sean de Wolski
2013-2-27
http://www.mathworks.com/matlabcentral/fileexchange/32536-annotation-pinned-to-axes Seems to be well liked.
You could also use a quiver plot.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!