我需要把数据放在matplotlib注释箭头的顶端,而不是尾部。我知道这不是它的本意。有没有一种方法可以得到箭头提示的坐标,这样我就可以在那个点上放置数据了?我还不知道如何解决这个问题。在
目前我的代码:
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, autoscale_on=False, xlim=(120,190), ylim=(190,260))
xy,xytext,col = (130,205),(185,250), 'b'
plt.plot(130,205,'ro')
plt.plot(185,250,'ro')
connectionstyle = "arc,angleA=180,angleB=-180,armA=135,armB=12,rad=2"
plt.annotate('', xy=xy, xycoords='data',
xytext=xytext, textcoords='data',
arrowprops=dict(arrowstyle="-", color=col,
shrinkA=0, shrinkB=0,
patchA=None, patchB=None,
connectionstyle=connectionstyle)
)
plt.annotate('', xy=xy, xycoords='data',
xytext=xytext, textcoords='data',
arrowprops=dict(arrowstyle="->", color=col,
shrinkA=0, shrinkB=110,
patchA=None, patchB=None,
connectionstyle=connectionstyle)
)
plt.show()
注意:我需要第一个注释来表示两点之间存在连接。我需要箭头来指示流向。我需要在箭头的顶端或附近放置一些文本,以指示流量。在
如何获得第二个注释命令绘制的箭头的坐标?在
目前没有回答
相关问题 更多 >
编程相关推荐