MATLAB: How to annotate the MATLAB figure with arrows

annotatearrowarrowsdrawfigureMATLABplacepointerpointsput

How do I annotate my MATLAB figure with arrows?

Best Answer

There are several ways to annotate your figure with arrows:
1. The TEXT command along with the LaTeX command will allow you to place an arrow on your plot. For example, if you wanted to annotate the location of sin(pi/3) on a sine wave, try the following:
x=0:0.1:2*pi % Creating array from 0 to 2pi
y=sin(x) % Creating sine wave
plot(x,y) % Plotting sine wave
text(pi/3,sin(pi/3),'\leftarrow{sin(\pi/3)}') % Annotates sin(pi/3) with a left arrow and text
2. You can use the ARROW function
2. You can use the PLOTEDIT function.
Type the following in the MATLAB Command Window to view the documentation on annotating your figure:
web([docroot '/techdoc/creating_plots/annota18.html#4741'])