- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to plot multiple histograms on same plot with Seaborn using Matplotlib?
To plot multiple histograms on same plot with Seaborn, we can take the following steps −
Create two lists (x and y).
Create a figure and add a set of two subplots.
Iterate a list consisting of x and y.
Plot a histogram with histplot() method using the data in the list (step 3).
Limit the X-axis range from 0 to 10.
To display the figure, use show() method.
import seaborn as sns from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x = [1, 5, 1, 4, 2] y = [7, 5, 6, 4, 5] fig, ax = plt.subplots() for a in [x, y]: sns.histplot(a, bins=4, ax=ax, kde=False) ax.set_xlim([0, 10]) plt.show()
- How to plot multiple Seaborn Jointplot in Subplot using Matplotlib?
- How to plot two violin plot series on the same graph using Seaborn?
- How to plot two histograms side by side using Matplotlib?
- How to plot histograms from dataframes in Pandas using Matplotlib?
- How to add a legend on Seaborn facetgrid bar plot using Matplotlib?
- Add minor gridlines to Matplotlib plot using Seaborn
- Plot multiple columns of Pandas DataFrame using Seaborn
- How to save a plot in Seaborn with Python (Matplotlib)?
- How to plot events on time using Matplotlib?
- How to plot a dashed line on a Seaborn lineplot in Matplotlib?
- How to plot multiple graphs in Matplotlib?
- How to plot int to datetime on X-axis using Seaborn?
- Python - Create a Time Series Plot using Line Plot with Seaborn
- How to plot with multiple color cycle using cycler property in Matplotlib
- How to plot two Pandas time series on the same plot with legends and secondary Y-axis in Matplotlib?