I am trying to sort categorical variables in the pandas plot x axis. I tried sorting from pandas dataframe itself but I can only sort it alphabetically. I don't see options in plot to sort it this way. I am trying to get x axis in this order: [Mon, Tue, Wed, Thru, Fri, Sat, Sun] . How do I do that?
df = data_df.groupby(['name1','weekday']).sum().reset_index()
s = (df.pivot_table(
index='weekday', columns='name1', values='count', aggfunc='sum'))
s.plot(kind='bar', stacked=True,figsize=(20,10),rot=0)
plt.show()
Looking for this output