This seems like it should be so simple but none of the online solutions work for me.
This is my code so far
sns.histplot(dataset['How long have you been cycling in Dublin?'], color="c", alpha=.6)
plt.title('How long have you been cycling in Dublin?', fontdict={'fontsize': 20})
plt.xlabel('Time')
plt.ylabel('Number of cyclists')
The histplot below simply counts the number of instances of each of the time period categories. The time periods of cycling experience are plotted on the x-axis but the categories have been plotted out of order. I just want to switch the first two bars.
The categories are the responses in the rows of the dataset and if I just list them this is the order I want them in:
lbls = list(np.unique(dataset['How long have you been cycling in Dublin?']))
lbls
['+3 years', '1 - 3 years', '3 months - 1 year', 'Less than 3 months']
Online solutions suggest including sort=False or or specifying order or labels within the sns.histplot call but these all produce the following error
AttributeError: 'PolyCollection' object has no property ___
Any simple solution that can be used across different datasets? i.e. a solution based on the author-defined categorical order not on alphabetical or numerical categorisation of these specific strings