I created a grouped dataset a using pandas dataframe. I then set one column as hue, another as the x axis, and another as the y. I wanted to overlay a swarm plot and a boxplot. However, while the boxplots are separated by hue, the swarmplots are directly on top of each other.
Format of my dataframe:
| x6 | y8 | z10 | |
|---|---|---|---|
| 0 | D8 | # | PGCLCs |
| 1 | D8 | # | PGCLCs |
| 2 | D15 | # | MACS |
| 3 | D15 | # | MACS |
| 4 | D21 | # | MACS |
Here is what I mean:
import seaborn as snssns.set_theme(style="whitegrid")sns.boxplot(data=hope2, x='x6', y='y8', hue='z10')sns.swarmplot(data=hope2, x='x6', y='y8', hue='z10')grouped dataset, both a swarmplot and boxplot on top of one another
What I want is for the orange swarmplot to be overlayed on the orange boxplot, and the blue swarmplots to be overlayed on the blue boxplots. Any assistance would be appreciated.