In this article, I am going to show you how to remove outliers from Seaborn boxplots. First, I am going to plot a boxplot without modifications. Then, I will remove all of the outliers. In the end, I am going to restore outliers, but this time I am going to make them less prominent.

Table of Contents

  1. Boxplot with outliers
    1. Get Weekly AI Implementation Insights
  2. Boxplot without outliers
  3. Change the outliers style

Boxplot with outliers

Let’s start with plotting the data I already have.

import seaborn as sb

sb.boxplot(x = 'Value', data = with_merged)

Get Weekly AI Implementation Insights

Join engineering leaders who receive my analysis of common AI production failures and how to prevent them. No fluff, just actionable techniques.

Boxplot without outliers

To remove the outliers from the chart, I have to specify the “showfliers” parameter and set it to false.

sb.boxplot(x = 'Value', data = with_merged, showfliers = False)

Change the outliers style

In the next example, I am going to change the size of the outliers markers to make them less distracting for people who look at the chart.

sb.boxplot(x = 'Value', data = with_merged, flierprops = dict(markerfacecolor = '0.50', markersize = 2))

Get Weekly AI Implementation Insights

Join engineering leaders who receive my analysis of common AI production failures and how to prevent them. No fluff, just actionable techniques.

Older post

Python memory management in Jupyter Notebook

How to avoid memory leaks in Jupyter Notebook

Newer post

Data engineering principles according to Gatis Seja

Lessons learnt from Gatis Seja's presentation about data engineering principles

Engineering leaders: Is your AI failing in production? Take the 10-minute assessment
>