您可以使用
annotate带有空白文本注释的方法并将
arrowprops字典设置为包括
arrowstyle='<->'以下内容来创建双向箭头:
import matplotlib.pyplot as pltplt.annotate(s='', xy=(1,1), xytext=(0,0), arrowprops=dict(arrowstyle='<->'))plt.show()

您可以使用
annotate带有空白文本注释的方法并将
arrowprops字典设置为包括
arrowstyle='<->'以下内容来创建双向箭头:
import matplotlib.pyplot as pltplt.annotate(s='', xy=(1,1), xytext=(0,0), arrowprops=dict(arrowstyle='<->'))plt.show()