Seaborn Distribution Plots - Introduction



Distribution plots compare the empirical distribution of sample data with the theoretical values anticipated from a specific distribution to visually analyze the distribution of sample data.

Seaborn facilitates the plotting of distribution plots by providing multiple functions. In the coming articles, we will discuss the multiple functions available in Seaborn that plot distribution plots.

Functions

The list of the distribution plots available in Seaborn are −

S.NO Method and Description
1 displot()

Method to plot distribution plots.

2 histplot()

Method to plot univariate or bivariate histograms.

3 kdeplot()

Method to plot univariate or bivariate plots using kernel density estimation.

4 ecdfplot()

Method to plot empirical cumulative distributions.

5 rugplot()

Method to plot marginal distribution along x and y axes.

Before moving on, we require data to plot graphs and in case, data is not available readily for your use, you can use the datasets present in the seaborn library.

Seaborn contains various default datasets in addition to being a statistical charting toolkit. We'll use the one of the in-built datasets as an example of a default dataset.

Let us consider the tips dataset in the first example. The 'tips' dataset comprises information about people who have likely eaten at a restaurant and whether they left a tip for the servers, as well as their gender, smoking status, and other factors.

Seaborn.get_dataset_names() method helps to retrieve all the names of the in-built datasets.

seaborn.get_dataset_names()

load_dataset() method helps to load the dataset with the name into a data structure.

Tips=seaborn.load_dataset('tips')

The above line of code helps to load the dataset with the name 'tips' into a data structure called tips.

Now that we have data to plot, let us understand how to plot distribution graphs using Seaborn library.

seaborn_function_reference.htm
Advertisements