You can easily create and style a histogram in Seaborn with just a few steps. Let’s get started. You will need a few dependencies to ensure that the plot is shown. The dependencies that you essentially need to load are Matplotlib and Seaborn. However, let’s load the standards such as Pandas and Numpy also in case there is a need to change the data set to use the Seaborn histogram. For this example, I am using the NBA players dataset that you can find on Kaggle.com. I am interested in the height distribution from 1950 to 2018.
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns
Next, let’s access the Seaborn histograms which is produced by the attribute distplot
This is the default histogram plot that has the default bins. You can also customize the number of bins using the bins parameter in your function.