Code

Seaborn Barplot

A barplot groups categorical data and uses some form of aggregation (mean by default) to create a visualization. Using the built in tips dataset, here is how to create a barplot of the mean total bill by sex.

# import the seaborn library import seaborn as sns # reading the dataset df = sns.load_dataset('tips') # plot barplot with seaborn # set variables for each axis # palette changes bar's colors sns.barplot(x ='sex', y ='total_bill', data = df, palette ='plasma')
Image 0

0

1

Updated 2021-06-21

Tags

Python Programming Language

Data Science