Close this search box.

Introduction to Python Matplotlib Histogram

In This Article, You Will Learn About Python Matplotlib Histogram.

Python Matplotlib Histogram – Before moving ahead, let’s take a look at Python Matplotlib Bars

Table of Contents

Matplotlib Histograms


A histogram graph shows the frequency distributions.

It’s a graph that shows the amount of observations that occur within the given time period.

Funny! We could say Histogram is a sort of graph, in which type of building is positioned in a row of various levels.

Create Histogram

To make a histogram using Matplotlib, we can use the hist() function.

The hist() function uses an array of number and creates an Histogram. Later, this array will be passed to the Pyplot the function as an input.

To make things easier, we employ NumPy to generate a random array of 80 values which will have values that are concentrated around 60 and the average deviation will be 20.

Find out more regarding the Normal Distribution of Data in the Machine Learning Lesson.

Example: Create a Normal Data Distribution from NumPy.

					import matplotlib.pyplot as plt
import numpy as np

x = np.random.normal(60, 20, 80)



Example: Create a histogram.

					import matplotlib.pyplot as plt
import numpy as np

x = np.random.normal(100, 10, 150)



If you find anything incorrect in the above-discussed topic and have any further questions, please comment below.

Connect on:

Recent Post

Popular Post

Top Articles


Share on