How to Create a Boxen Plot in Seaborn

01.26.2021

Intro

A boxen plot is another plot to view distribution and summary statistics. The plot creates more quantiles when compared to a simple box plot. These extra quantiles allow for more detail over the distribution. In this article, we will learn how to create a Boxen Plot in Seaborn.

Creating a Boxen Plot

To create a Boxen Plot we use the boxenplot method and pass a list of data to the x named parameter. The example below creates a boxen plot using a list of bill totals.

import seaborn as sns

tips = sns.load_dataset("tips")

sns.boxenplot(x = tips["total_bill"])

Creating Multiple Boxen Plots

We can also create boxen plots groupped by a category. To do this, we specify a category to the x named parameter and the continous variable to the y named parameter. In the example below we displat the distribution of bill totals groupped by day.

import seaborn as sns

tips = sns.load_dataset("tips")

 sns.boxenplot(x = "day",
			   y = "total_bill",
			   data = tips)