Code

Seaborn Violinplot

A violinplot is like a boxplot but it does a better job of showing the density of the data. Using the built in tips dataset, here is how to create a violinplot of the total bill by day for males and females.

# import the seaborn libaray import seaborn as sns # reading the dataset df = sns.load_dataset('tips') # create violinplot # set variables for each axis # split = True draws half of the violin for each group sns.violinplot(x='day', y='total_bill', data=df, hue='sex', split=True)
Image 0

0

1

Updated 2021-06-21

Tags

Python Programming Language

Data Science