plt.figure(figsize=(12,7))
sns.relplot(kind='line',data=merge_wrp,x='month_name',y='Amount_tran',hue='Product',
errorbar=None,row_order=['April','May','June','July', 'August','September',
'October','November','December','January', 'February','March'])
plt.xticks(rotation=50)
plt.show()
row_order
and col_order
don't refer to the x-or-y axis
of one plot. It make sense if you use col
and row
parameters to draw more than one chart.
In your case, you have to sort your dataframe first. It can be done with pd.CategoricalDType
:
months = ['April','May','June','July', 'August','September',
'October','November','December','January', 'February','March']
cat = pd.CategoricalDtype(months, ordered=True)
sns.relplot(data=merge_wrp.astype({'month_name': cat}),
x='month_name', y='Amount_tran', hue='Product',
kind='line', errorbar=None)
plt.xticks(rotation=50)
plt.show()