Maroon
Maroon

Reputation: 105

Edgecolor of violinplot in Seaborn is not determined by the hue

I have created a violinplot substantially similar to one in the Seaborn gallery:

import seaborn as sns
sns.set(style="whitegrid", palette="pastel", color_codes=True)

tips = sns.load_dataset("tips")

sns.violinplot(x="day", y="total_bill", hue="sex", data=tips, split=True,
           inner="quart", palette={"Male": "b", "Female": "y"})
sns.despine(left=True)

However, I have been unable to vary the edgecolor by hue ("Male" and "Female" in the example above). A previous answer on Stack Exchange solved this problem in the context of a Seaborn stripplot, but the geometry of the violinplot appears to require a different solution.

Upvotes: 0

Views: 672

Answers (1)

cphlewis
cphlewis

Reputation: 16259

I think this is just how seaborn's violinplot currently works. In the source code (site-packages/seaborn/distributions.py, in violinplot():

    for side in [-1, 1]:
        ax_plot((side * dens) + x, y, c=gray, lw=lw)

so:

When you find it on your system you can edit it.

The docstring is explicit that the color arguments are for the inside of the violins:

color : mpl color, sequence of colors, or seaborn palette name
        Inner violin colors

Upvotes: 2

Related Questions