How to Create a Swarm Plot in Seaborn

01.25.2021

Intro

Another common distribution plot is the swarm plot. The swarm plot is similar to the violin plot, but allows you to view each observation. In thie article, we will learn how to create a Swarm Plot in the Seaborn library.

Creating a Swarm Plot

To create a swarm plot, we pass an array of data to the x named parameter in the swarmplot method. In the example below, we plot a list of bill totals and view the distribution on a swam plot. We can also see each individual bill total.

import seaborn as sns

tips = sns.load_dataset("tips")

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