我在获取由函数FancyArrowPatch
绘制的多边形的顶点坐标时遇到问题。
我的代码如下:
import matplotlib
import matplotlib.patches as mpatches
fig, ax = plt.subplots(1)
ax.plot([-199, 592], [0,0], zorder=-1000, c="k",linewidth=0.5)
arrowstyle = mpatches.ArrowStyle.Simple(head_width=14,
tail_width=14,
head_length=8.4)
y = 0
x1=1;x2=393
patch = mpatches.FancyArrowPatch([x1, y], [x2, y],
shrinkA=0.0, shrinkB=0.0,
arrowstyle=arrowstyle)
ax.add_patch(patch)
图片是这样的:
我尝试运行函数patch.get_path_in_displaycoord()
,但这返回
(Path(array([[ 0. , 7. ],
[192.30080795, 7. ],
[384.60161591, 7. ],
[384.60161591, 7. ],
[388.80080795, 3.5 ],
[393. , 0. ],
[388.80080795, -3.5 ],
[384.60161591, -7. ],
[384.60161591, -7. ],
[192.30080795, -7. ],
[ 0. , -7. ],
[ 0. , 7. ],
[ 0. , 7. ]]), array([ 1, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 2, 79], dtype=uint8)), True).
很显然,这不是图形中的实际顶点坐标,所以我如何获取图形的顶点坐标?