# Draw an arrow using matplotlib in Python

In this article, we are going to learn how to draw an arrow inside the plot using matplotlib in Python. An arrow is drawn in the plot to show the specific part of the graph or plot, however, to annotate the plot or graph we add the textboxes inside the plot.

Arrow is drawn inside the plot using the inbuilt function pyplot.annotate() and if we want to draw the only arrow as a plot then we have to work with the pylab module. Let’s understand with some example:-

• Plotting of the only arrow inside the plot
```import pylab as p

#p.arrow( x, y, dx, dy, **kwargs )

p.show()```

The output plot will looks like the figure: In the above example, we first imported the pylab module and then we use the function pylab.arrow() and we passed the required arguments provided in the code in the form of a comment.

The first argument is x-coordinate, the second argument is y-coordinate of the arrow and the third and fourth arguments are the distance from the x-coordinate(x+dx) and distance from the y-coordinate(y+dy), and then we provided the fc=face color and ec=edge color and then we provided the head_width and head_length. Then we use the pylab.show() function to show the drawn arrow.

• Plotting of arrow inside the plot with figure
```import numpy as np
import matplotlib.pyplot as plt
X = np.linspace(-3.9, 5, 1019)
Y = .24 * (X + 3.8) * (X + 0.9) * (X - 1.8)
plt.annotate('Brackmard minimum',
ha = 'center', va = 'bottom',
xytext = (-1.8, 3.5),xy = (0.69, - 1.7),arrowprops = {'facecolor' : 'black'})
plt.plot(X, Y)
plt.show()```

Below is the given output figure: In this example, we first imported the required module such as matplotlib and numpy and then we created a numpy linspace from -3.9 to 5 and stored in X and then we established the relation between X and Y.