Is it possible to annotate arrows (or other annotation objects) in subplots?
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!