У меня есть следующий код:
fig, ax = plt.subplots(1, 1, figsize=(7.2, 7.2))
start = (0.1, 0.1)
end = (0.5, 0.5)
connectionstyle='angle,angleA=-90,angleB=10,rad=5'
ax.annotate("",
xy=end, xycoords='data',
xytext=start, textcoords='data',
arrowprops=dict(arrowstyle="->",
color="0.5",
shrinkA=5, shrinkB=5,
patchA=None,
patchB=None,
connectionstyle=connectionstyle,
),)
, который может генерировать такую фигуру,

Однако, еслиЯ использую параметры, такие как width
, headwidth
вместо arrowstyle
, я всегда получаю сообщение об ошибке.Тот же набор кодов, который имеет отчет об ошибке:
fig, ax = plt.subplots(1, 1, figsize=(7.2, 7.2))
start = (0.1, 0.1)
end = (0.5, 0.5)
connectionstyle='angle,angleA=-90,angleB=10,rad=5'
ax.annotate("",
xy=end, xycoords='data',
xytext=start, textcoords='data',
arrowprops=dict(#arrowstyle="->",
width=10,headwidth=30,
color="0.5",
shrinkA=5, shrinkB=5,
patchA=None,
patchB=None,
connectionstyle=connectionstyle,
),)
Если я изменю connectionstyle
на 'arc3, rad = 1', он будет работать нормально.
fig, ax = plt.subplots(1, 1, figsize=(7.2, 7.2))
start = (0.1, 0.1)
end = (0.5, 0.5)
connectionstyle='arc3, rad=1' # connectionstyle NOW arc3
ax.annotate("",
xy=end, xycoords='data',
xytext=start, textcoords='data',
arrowprops=dict(#arrowstyle="->",
width=10,headwidth=30,
color="0.5",
shrinkA=5, shrinkB=5,
patchA=None,
patchB=None,
connectionstyle=connectionstyle,
),)