如何在matplotlib中更改双头注释的头大小? [英] How to change the head size of the double head annotate in matplotlib?
本文介绍了如何在matplotlib中更改双头注释的头大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下图显示了哪个箭头很小的图...
Below figure shows the plot of which arrow head is very small...
我尝试了下面的代码,但没有奏效...它说提高AttributeError('未知属性%s'%k)AttributeError:未知属性头宽" ...
I tried below code, but it didnot work... it said " raise AttributeError('Unknown property %s' % k) AttributeError: Unknown property headwidth"...
xyfrom=[10,620]
xyto=[130,620]
ax.annotate("",xyfrom,xyto,arrowprops=dict(arrowstyle='<->',linewidth = 2, headwidth=10,color = 'k'
))
ax.text((xyto[0]+xyfrom[0])/2-15,(xyto[1]+xyfrom[1])/2+10,"headwidth is too small",fontsize=24)
推荐答案
我相信这是因为您需要在字符串中输入arrowstyle参数.试试这个:
I believe it's because you need to give your arrowstyle arguments inside a string. Try this:
arrowprops=dict(arrowstyle='<->, head_width=10', facecolor='k')
,注意这是一个完整的字符串:
, notice how this is a full string:
'<->, head_width=10'
在matplotlib中这是一个非常奇怪的选择,我真的不明白为什么应该这样.无论如何,看看是否能解决您的问题.
It's a really strange choice in matplotlib, one I really don't understand why should it be this way. In any case see if solves your problem.
这篇关于如何在matplotlib中更改双头注释的头大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文