Draw arrow in a plot
1,006 views (last 30 days)
Show older comments
Hi all, i have a question. I am creating a GUI that import real time data. I want draw a vertical line or a arrow if a condition is met.
For example:
n=length(p);
for i=1:n;
if p>100 && t>100
annotation=('arrow');
end
end
Is this correct for draw arrow in a plot in real time?
Thank you very much
0 Comments
Accepted Answer
Geoff Hayes
on 23 May 2015
annotation=('arrow');
would not work since you are assigning the string arrow to a variable called annotation. Instead you would want to do something like
X = [0.5 0.5];
Y = [0 0.5];
annotation('arrow',X,Y);
which would draw an arrow starting at the coordinate (0.5,0) and ending at (0.5,0.5). (Note that the coordinates are specified in normalized figure units which means that the arrow would be drawn in the middle.)
While you need not provide the X and Y inputs to this function, be aware that the default values will be used in place (of them) so the arrow may not be drawn where you expect it to be.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!