向图形添加箭头注释

时间:2019-09-29 01:47:05

标签: python matplotlib seaborn

我只需要在图形中添加箭头注释即可。我尝试了多种解决方案,但找不到正确的答案。

另一个样子

component_arrow = NewArrowAnnotation(100,100,200,200)

arrow.ComponentSetForegroundColor( 0, 1, 1 )

disp.ComponentAddChildAtEnd(arrow)

另一种尝试

plt.annotate("Qatar",

        `xy=(20, 20), xycoords='data',`

        `xytext=(10^5, 90), textcoords='data',`

        `arrowprops=dict(arrowstyle="->"),`

        `)`

另一种尝试

plt.annotate('qatar_income',

     `xy=(6.28, 1),` 

     `xytext=(10, 4),`

     `y='qatar_lifespan'`

     `)`

qatar = now[now.country == 'Qatar']

qatar_income = qatar.income.values[0]

qatar_lifespan = qatar.lifespan.values[0]

sns.relplot(x="income",

        `y="lifespan",` 

        `hue="6region",` 

        `size="population",`

        `sizes=(40, 200),` 

        `alpha=.5,` 

        `palette="muted",` 

        `height=6,` 

        `data=now);`

plt.xscale('log')

plt.ylim([0, 90])

plt.title('The World in 2018')

plt.text(x=qatar_income-7000, y=qatar_lifespan+1, s = 'Qatar')

NewArrowAnnotation方法获取未定义的“ NewArrowAnnotation”。其他方法什么也没显示。

0 个答案:

没有答案