What is the correct way to create a violin plot that has one violin split by hue
?
I've tried different approaches and it seems that the only way is to create a feature that shares the same value for every entry in the dataset. And pass that feature's name as x
.
fig = plt.figure(figsize=(20, 8))
fig.add_subplot(1, 3, 1)
ax = sns.violinplot(x='feature', y='height',
data=train_cleansed_height,
scale='count',
hue='feature', split=True,
palette='seismic',
inner='quartile')
fig.add_subplot(1, 3, 2)
ax = sns.violinplot(x='workaround', y='height',
data=train_cleansed_height,
scale='count',
hue='feature', split=True,
palette='seismic',
inner='quartile')
fig.add_subplot(1, 3, 3)
ax = sns.violinplot(x=None, y='height',
data=train_cleansed_height,
scale='count',
hue='feature', split=True,
palette='seismic',
inner='quartile')
plt.xlabel('x=None')
But is it the correct way?