偏移文本批注创建者matplotlib.ann

2024-10-01 07:42:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在创建一个带有matplotlib中带注释的文本注释的箭头,并希望从箭头末端偏移文本。在

import matplotlib.pyplot as plt

ax = plt.subplot()
ax.annotate(
    "test",
    xy=(0.2, 0.2),
    xytext=(0.5, 0.5),
    arrowprops=dict(
        arrowstyle="simple",
        facecolor="black",
    )
)

plt.show()

此处创建的文本仅指向箭头的末尾。有没有办法用人工坐标来抵消它?在


Tags: test文本importmatplotlibasplt箭头ax