His To Graph
His To Graph
Example: Say you ask for the height of 250 people, you might end up with a histogram like
this:
You can read from the histogram that there are approximately:
Create Histogram
In Matplotlib, we use the hist() function to create histograms.
The hist() function will use an array of numbers to create a histogram, the array is sent into
the function as an argument.
For simplicity we use NumPy to randomly generate an array with 250 values, where the
values will concentrate around 170, and the standard deviation is 10
Example
A Normal Data Distribution by NumPy:
import numpy as np
print(x)
The hist() function will read the array and produce a histogram:
Example
A simple histogram:
import matplotlib.pyplot as plt
import numpy as np
plt.hist(x)
plt.show()