怎么在matplotlib的图中加入箭头标志注释?如下图的这种
1个回答
用plt.annotate可以表示箭头标注,参考文档。小例子如下:
import matplotlib.pyplot as plt
plt.plot([-1, 0, 1], [1, 0, 1])
plt.annotate('Local min',
xy=(0, 0),
xycoords='data',
xytext=(0.7, 0.2),
textcoords='axes fraction',
arrowprops=dict(arrowstyle="->"))
plt.show()