Displots

Learn how to plot, design, and interpret displots for data visualizations.

Overview

Displot stands for distribution plots. We can access all the distribution plots within a displot. It’s built on top of seaborn’s FacetGrid object, which allows us to display multiple plots in parallel.

Univariate displot

Let’s get started by importing the required libraries and setting the default seaborn theme. Next, we import the tips dataset and save it in the variable tips_df. Finally, we plot a displot by calling the sns.displot() function and pass x='total_bill' (which plots a histogram by default), as shown in the plot below. Moreover, we save the FacetGrid object returned by the sns.displot() function in the variable g to access the plot’s axes. Then, we iterate g.axes which contains a NumPy array of axes. Finally, we use the NumPy array attribute flat to iterate over g.axes. Inside the for loop, we use the bar_label() ...