I am trying to make a violinplot using only the y and hue parameters in seaborn (x data variable is defined as None). Using a similar example as in the documentation I have done:
tips = sns.load_dataset("tips")
sns.violinplot(y="total_bill", hue="sex", data=tips, split=True)
And the resulting figure is not split according to the hue variable.

When the x variable is defined the plot is split. Is there any way to have a split plot in seaborn without x input?
Simply add a variable that is the same for all entries and use it as x:
tips = sns.load_dataset("tips")
tips["all"] = ""
ax = sns.violinplot(x="all", y="total_bill", hue="sex", data=tips, split=True)
ax.set_xlabel("")

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With