I would like to combine this violin storyline http://seaborn.pydata.org/generated/seaborn.violinplot.html (fourth example with split = True) with this http://seaborn.pydata.org/examples/elaborate_violinplot.html .
Actually, I have a dataFrame with a column Success(Yes or No) and several columns of data. For instance:
df = pd.DataFrame(
{"Success": 50 * ["Yes"] + 50 * ["No"],
"A": np.random.randint(1, 7, 100),
"B": np.random.randint(1, 7, 100)}
)
A B Success
0 6 4 Yes
1 6 2 Yes
2 1 1 Yes
3 1 2 Yes
.. .. .. ...
95 4 4 No
96 2 1 No
97 2 6 No
98 2 3 No
99 2 1 No
I would like to plot a violin graph for each data column. It works with:
import seaborn as sns
sns.violinplot(data=df[["A", "B"]], inner="quartile", bw=.15)
But now I would like to break the violin according to the column Success. But using hue="Success", I got an error with Cannot use 'hue' without 'x' or 'y'. So, how can I do to plot the violin, broken by the column "Success"?