以下代码将生成带有matplotlib的花式箭头:
import matplotlib.pyplot as plt
xy = [0.2,0.2]
xytext =[0.5,0.5]
plt.figure()
ax = plt.gca()
ax.annotate("", xy=xy, xytext=xytext,arrowprops=dict(arrowstyle="<|-", edgecolor = 'k', facecolor = 'r', shrinkA = 0, shrinkB = 0))
箭头为红色,黑色边缘。如何控制黑色边缘的宽度?
1 个答案:
答案 0 :(得分:0)
您可以使用linewidth
参数。下面是一个示例
import matplotlib.pyplot as plt
xy = [0.2,0.2]
xytext =[0.5,0.5]
plt.figure()
ax = plt.gca()
ax.annotate("Text", xy=xy, xytext=xytext, arrowprops=dict(arrowstyle="<|-,
head_width=2, head_length=2", edgecolor = 'k', facecolor = 'r',
linewidth=4))