Reputation: 4776
I have the name of the day of the week on the x-axis of my seaborn scatterplot.
I want to order it according to the following natural order
cats = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
I tried following which is working for other plot types:
sns.scatterplot(data=df, x='Day', y='Time', hue='Type', order= cats)
But gives me an error: it seems like order is not in the scatterplot func. How to solve this?
File "/..lib/python3.7/site-packages/matplotlib/artist.py", line 970, in _update_property
.format(type(self).__name__, k))
AttributeError: 'PathCollection' object has no property 'order'
Upvotes: 0
Views: 1526
Reputation: 51
Use this code instead of order:
sns.scatterplot(data=df, x='Day', y='time', hue_order= ['cats'])
Upvotes: 1