Python Matplotlib.pyplot.annotate()语法错误
试着运行这个Python Matplotlib.pyplot.annotate()语法错误,python,matplotlib,Python,Matplotlib,试着运行这个 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),shrink=0.05),arrowprops=dict(facecolor='black', ) plt.ylim(-2,2) plt.show() 但出现以下错误: plt.annotate('l
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),shrink=0.05),arrowprops=dict(facecolor='black', )
plt.ylim(-2,2)
plt.show()
但出现以下错误:
plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5),shrink=0.05),arrowprops=dict(facecolor='black', )
^
SyntaxError: cannot assign to function call
怎么了?提前谢谢你 如中所示,收缩
属于箭头道具内部
:
plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
arrowprops=dict(shrink=0.05, facecolor='black'))