Table of Contents
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.
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) print(x)
Example: Create a histogram.
import matplotlib.pyplot as plt import numpy as np x = np.random.normal(100, 10, 150) plt.hist(x) plt.show()
If you find anything incorrect in the above-discussed topic and have any further questions, please comment below.