How to make `seaborn.violinplot` `boxplot` `showfliers`?
Oct 13, 8:55am
seaborn.violinplot doesn't expose a showfliers option — the inner box (inner="box") draws the box and whiskers, but never the outlier markers. You have two practical workarounds:
Option 1: Overlay a hidden boxplot that only shows fliers
python
import seaborn as sns
import matplotlib.pyplot as plt
df = sns.load_dataset("tips")
order = ["Thur", "Fri", "Sat", "Sun"]
ax = sns.violinplot(data=df, x="day", y="total_bill", inner="box", order=order)
# overlay an invisible boxplot that only renders its outliers
data = [df.loc[df["day"] == d, "total_bill"] for d in order]
ax.boxplot(
data,
positions=range(len(order)),
widths=0.05,
showbox=False, showwhiskers=False, showcaps=False, showmedians=False,
flierprops=dict(marker="o", markerfacecolor="none", markersize=5),
)
plt.show()
Since both matplotlib and seaborn define outliers as points beyond 1.5 × IQR, the fliers land exactly where the violin's whiskers end.