I use python3 , seaborn countplot , my question :
- how to add the count values for everybar? Show the label at the top of
each bar
- how to make these bars in descending order ?
i wrote this:
fig = plt.figure(figsize=(10,6))
sns.countplot(data_new['district'],data=data_new)
plt.show()
enter image description here
Thanks a lot !
I used a simple example data I generated but you can replace the df name and column name to your data:
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))
This generates:
You will be likely to play around with the location a little bit to make it look nicer.