我使用python3,seaborn countplot,我的问题:
我写了这个:
fig = plt.figure(figsize=(10,6)) sns.countplot(data_new['district'],data=data_new) plt.show()
enter image description here
非常感谢 !
我使用了生成的简单示例数据,但您可以将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))
这会产生:
您可能会稍微调整一下位置以使其看起来更漂亮。