
How to add annotations to plots using plot own coordinate system and not the figure?
Posted:
Nov 11, 2012 2:54 AM


I have no used annotation in Matlab before. But it seems strange that one can only use Figure based coordinates and not the actual data used to make a plot.
For example, suppose I have a simple plot of a sin() and want to make an arrow from (0,0) to say (pi,1):
 close all x = pi:pi/10:pi; plot(x,sin(x)); 
Now if I use annotation('textarrow',x,y), then the 'x' and 'y' in this call wants coordinates relating to the figure window itself and not to the plot coordinates.
This makes these annotation useless really to use. One now needs a way to map the plot data location (pi,1) to find where it is physically located on the figure window.
Is there a way to be able to use these annotations but use coordinates (x,y) based on the actual plot data and not the figure itself?
http://www.mathworks.com/help/matlab/ref/annotation.html
thanks, Nasser

