如何使箭头变薄matplotlib [英] how to make arrow thinner matplotlib

查看:55
本文介绍了如何使箭头变薄matplotlib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我绘制了一个如下的箭头,虽然我认为它有点大.我怎样才能使它更薄更小?谢谢

I plot an arrow as below, whilst I think it's a little bit big. How can I make it thinner and smaller? Thank you

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))

推荐答案

您应该尝试调整 width 参数(来自

You should try adjusting the width parameter (from the docs)

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)
)

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

I've adjusted your snippet to make the parameter more obvious. Note also that width is in points, so you may need to try a few different values out. Other values worth looking at are frac. headwidth and shrink (also in the docs), especially if you want to make the head smaller too!

这篇关于如何使箭头变薄matplotlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆