plt annotate 绘制箭头

ax,plt.subplot(111)
t = np.arange(0.0, 5.0, 0.01)
s = np.cos(2*np.pi*t)
line, = plt.plot(t, s, lw=2)
plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
    arrowprops=dict(facecolor='black', shrink=0.08),
        )
plt.ylim(-2, 2)
plt.show()

在这里插入图片描述
annotate
其中:

keyValue
xyto
xytextfrom
arrowprops样式