- 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 plot a histogram using Matplotlib in Python with a list of data?
To plot a histogram using Matplotlib, we can follow the steps given below −
Make a list of numbers and assign it to a variable x.
Use the plt.hist() method to plot a histogram.
Compute and draw the histogram of *x*.
We can pass n-Dimensional arrays in the hist argument also.
To show the plotted figure, use the plt.show() method.
Example
from matplotlib import pyplot as plt x = [300, 400, 500, 2000, 10] plt.hist(x, 10) plt.show()
Output
- Related Articles
- How to plot a line graph from histogram data in Matplotlib?
- How to make a histogram from a list of data in Matplotlib?
- Python - Plot a Histogram for Pandas Dataframe with Matplotlib?
- How to plot collections.Counter histogram using Matplotlib?
- How to plot a 2D histogram in Matplotlib?
- How to center labels in a Matplotlib histogram plot?
- How to make a 4D plot with Matplotlib using arbitrary data?
- How to plot hexbin histogram in Matplotlib?
- Plot a histogram with Y-axis as percentage in Matplotlib
- Plot a histogram with colors taken from colormap in Matplotlib
- Matplotlib – Make a Frequency histogram from a list with tuple elements in Python
- How to save a histogram plot in Python?
- How to plot a bar chart for a list in Python matplotlib?
- How to plot CSV data using Matplotlib and Pandas in Python?
- How to plot 1D data at a given Y-value with PyLab using Matplotlib?

Advertisements