标签: python-3.x seaborn
我使用python3,seaborn countplot,我的问题:
fig = plt.figure(figsize=(10,6)) sns.countplot(data_new['district'],data=data_new) plt.show()
enter image description here
非常感谢!
答案 0 :(得分:5)
我使用了我生成的简单示例数据,但您可以将df名称和列名替换为您的数据:
ax = sns.countplot(df["coltype"], order = df["coltype"].value_counts().index) for p, label in zip(ax.patches, df["coltype"].value_counts().index): ax.annotate(label, (p.get_x()+0.375, p.get_height()+0.15))
这会产生:
您可能会稍微调整一下位置,使其看起来更漂亮。