Seaborn Histogram

  • Post category:Seaborn

In this Seaborn tutorial, you will learn how to plot a seaborn histogram in Python. You can use sns.histplot() to plot histogram.

# import required modules
import seaborn as sns
import matplotlib.pyplot as plt

# load the dataset
var = sns.load_dataset('iris')

# create a histogram using seaborn
sns.histplot(var['sepal_length'])

# set the title of the plot
plt.title('Histogram')

# save the plot
plt.savefig('histogram.png')

# show the plot
plt.show()

Output:

Seaborn Histogram

Free resources to learn advanced skills: AiHints and CodeAllow