问题描述
ax.annotate
不适用于这个特定的 column
。但是,它适用于 columns
中的所有其他 dataset
。无法理解为什么。任何帮助将不胜感激。
plt.figure(figsize=(15,8))
sns.countplot(x = 'How many employees does your company or organization have?',data = df)
plt.xticks(rotation = 45,fontsize = 15,ha = "right")
plt.yticks(fontsize = 15)
plt.xlabel('How many employees does your company or organization have?',fontsize = 15)
plt.ylabel('Count',fontsize = 15)
plt.title('Entire Data')
for p in ax.patches:
width,height = p.get_width(),p.get_height()
x,y = p.get_xy()
ax.annotate(f'{height/df.shape[0]:.0%}',(x + width/2,y + height + 1),ha='center',fontsize = 15)
plt.show()
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)