November 2018
Beginner to intermediate
214 pages
5h 2m
English
The annotate method has a lot of arguments, as seen in the following code:
# Add an arrownums = np.arange(0,10,0.1)plt.plot(nums, np.sin(nums))plt.annotate("", xy=(np.pi/2, 1), xytext=(5,0), arrowprops=dict(facecolor='k'))
The first argument in the preceding code is an empty string that will be displayed. xy tells us where the data coordinates are placed, which is the head. xytext tells us where the text of the tail of the arrow will be placed and the arrowprops argument explains without specifying a color for the arrow—it only uses text that will be displayed. We will start by looking at the arrow itself since we already know how to add text.
As you can see in the following output, we get ...
Read now
Unlock full access