Is there a simple way to ignore zero count categories when laying out a violinplot. In the example below, there are no cases of 'Yes:Red' and 'No:Green' but the violinplot still plots the "missing" categories. I can see why this should be the default behavior, but is there some way to change the factors used in the hue to suppress this and remove the whitespace?
df = pd.DataFrame(
{'Success': 50 * ['Yes'] + 50 * ['No'],
'Category': 25 * ['Green'] + 25 * ['Blue'] + 25 * ['Green'] + 25 * ['Red'],
'value': np.random.randint(1, 25, 100)}
)
sns.violinplot(x='Success', y='value', hue='Category', data=df)
plt.show()
Thanks in advance.
