- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 make a histogram from a list of data in Matplotlib?
To make a histogram from a list of data in matplotlib, we can take the following steps−
- Create a list of data, i.e., x data points
- Plot a histogram with x data points.
- To display the figure, use show() method.
Example
from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x = [[300, 400, 500, 2000, 10], [300, 400, 500, 2000, 10], [300, 400, 500, 2000, 10], [300, 400, 500, 2000, 10], [300, 400, 500, 2000, 10]] plt.hist(x, 10) plt.show()
Output
- Related Articles
- Matplotlib – Make a Frequency histogram from a list with tuple elements in Python
- How to plot a histogram using Matplotlib in Python with a list of data?
- How to plot a line graph from histogram data in Matplotlib?
- Plotting a histogram from pre-counted data in Matplotlib
- How to make a histogram with bins of equal area in Matplotlib?
- How to plot a 2D histogram in Matplotlib?
- How to make a log histogram in Python?
- How to center labels in a Matplotlib histogram plot?
- Plot a histogram with colors taken from colormap in Matplotlib
- How to get a reverse-order cumulative histogram in Matplotlib?
- How to extract data from a Matplotlib plot?
- How to make a 4D plot with Matplotlib using arbitrary data?
- How to make list of data frames in R?
- How to plot hexbin histogram in Matplotlib?
- How to retrieve XY data from a Matplotlib figure?

Advertisements