Code

Seaborn Boxplot

A boxplot takes quantitative data by groups and displays it through quartiles while also showing any outliers in the data. Using the built in tips dataset, here is how to create a boxplot of total bill by day for smokers and non smokers.

# import the seaborn libaray import seaborn as sns # reading the dataset df = sns.load_dataset('tips') # create boxplot # hue changes color of boxplot based on whether smoker on not sns.boxplot(x='day', y='total_bill', data=df, hue='smoker')
Image 0

0

1

Updated 2021-06-21

Tags

Python Programming Language

Data Science