如何更改matplotlib中双头注释的头大小?

2024-10-02 10:32:42 发布

您现在位置:Python中文网/ 问答频道 /正文

下图显示了箭头非常小的绘图。。。 enter image description here

我试过下面的代码,但没用。。。 它说“raise AttributeError('未知属性%s'%k)” AttributeError:未知属性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)

Tags: 代码绘图属性箭头axdictraiseattributeerror
1条回答
网友
1楼 · 发布于 2024-10-02 10:32:42

我相信这是因为你需要在一个字符串中给出你的arrowstyle参数。试试这个:

 arrowprops=dict(arrowstyle='<->, head_width=10', facecolor='k')

,请注意这是一个完整的字符串:

^{pr2}$

在matplotlib中这是一个非常奇怪的选择,我真的不明白为什么要这样。不管怎样,看看能不能解决你的问题。在

相关问题 更多 >

    热门问题