Reputation: 107
I am trying to plot a swarmplot using categorical variables in the X-Y axis. I used melt to make a dataframe that looks like this:
Day Condition Category value
4 WT cat1 96.0
4 WT cat1 74.0
7 WT cat1 48.0
7 WT cat1 79.0
10 WT cat1 29.0
10 WT cat1 49.0
4 WT cat2 50.0
4 WT cat2 57.0
4 WT cat2 57.0
7 WT cat2 75.0
7 WT cat2 49.0
10 WT cat2 51.0
10 WT cat2 71.0
4 WT cat3 19.0
4 WT cat3 14.0
7 WT cat3 54.0
7 WT cat3 30.0
...
I would like to get a swarmplot showing the 'Category' in the y-axis and the 'Day' in the x-axis. In addition, the number of observations (Column 'value') should correspond to dots in every category per day.
Any help is highly appreciated,
Upvotes: 0
Views: 231
Reputation: 153510
IIUC,
sns.swarmplot(x='Day', y='value', hue='Category', data=df)
Output:
Upvotes: 2