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](https://codeallow.com/wp-content/uploads/2022/09/image-21.png)
Free resources to learn advanced skills: AiHints and CodeAllow