countplot does not have option for the ordering of the x values
See original GitHub issueThe count plot function does not have any way to order the values. The default ordering of x is incorrect.
I used the following code:
ax = sns.countplot(x=("PhdDecade", "first"),
data=df_faculty, color="grey")
for p in ax.patches:
height = p.get_height()
ax.text(p.get_x()+0.25, height+ 3, 'n=%.0f'%(height))

Seaborn version: 0.7.0
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Seaborn.countplot : order categories by count - Stack Overflow
countplot as far as I know - the order parameter only accepts a list of strings for the categories, and leaves the ordering...
Read more >seaborn.countplot — seaborn 0.12.1 documentation - PyData |
A count plot can be thought of as a histogram across a categorical, instead of quantitative, variable. The basic API and options are...
Read more >Seaborn countplot: set order, size, palette and values
Create a Seaborn countplot using Python: a step by step example ... As you can see above, the current order of the x-axis...
Read more >Countplot using seaborn in Python - GeeksforGeeks
countplot () method is used to Show the counts of observations in each categorical bin using bars. Syntax : seaborn.countplot(x=None, y=None, hue ...
Read more >sns.countplot order - Mj Cheruiyot - Medium
seaborn.countplot (*, x=None, y=None, hue=None, data=None, order=None, ... Your tip will go to Mj Cheruiyot through a third-party platform of their choice, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

try this, should be desc by counts
if you need asc
Also, might try:
df_faculty[‘PhdDecade’] = pd.Categorical(df_faculty[‘PhdDecade’], categories = [‘1950’s’,‘1960’s’,‘1970’s’,‘1980’s’,‘1990’s’,‘2000’s’,‘2010’s’], ordered = True)