如何使箭头更薄matplotlib

wuw*_*cat 8 python matplotlib

我在下面画一个箭头,虽然我认为它有点大.我怎样才能让它变得更薄更小?谢谢

for i in range(len(x)):
    plt.annotate(df.index[i],xy=(x[i],y[i]),xytext=(x[i]+1.31,y[i]-0.55),arrowprops=dict(facecolor='blue', shrink=0.1))
Run Code Online (Sandbox Code Playgroud)

dan*_*van 6

你应该尝试调整width参数(来自文档)

plt.annotate(df.index[i], 
    xy=(x[i],y[i]), xytext=(x[i]+1.31,y[i]-0.55),
    arrowprops=dict(facecolor='blue', shrink=0.1, width=2)
)
Run Code Online (Sandbox Code Playgroud)

我调整了你的代码片段,使参数更加明显.另请注意,这width是分数,因此您可能需要尝试一些不同的值.其他值得关注的值是frac.headwidthshrink(也在文档中),特别是如果你想让头变得更小!