Draw arrow in a plot

1,006 views (last 30 days)
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:
for i=1:n;
if p>100 && t>100
Is this correct for draw arrow in a plot in real time?
Thank you very much

Accepted Answer

Geoff Hayes
Geoff Hayes on 23 May 2015
Francisco - you may want to read the documentation on annotation. Your code of
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];
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.
francisco gonzalez
francisco gonzalez on 23 May 2015
Thank you very much Geoff. I am going to study this code and apply to my situation.

Sign in to comment.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!