January 2019
Beginner
318 pages
8h 23m
English
This type of plot helps us to examine the distribution of numerical data in such a way that you are unable to make do with mean or median alone. We are going to use the hist() method to create a simple histogram. Let's look at an example to create a simple histogram. For that, create a script called histogram_example.py and write the following content in it:
import matplotlib.pyplot as pltimport numpy as npx = np.random.randn(500)plt.hist(x)plt.show()
Run the script and you will get the following output:
student@ubuntu:~/work$ python3 histogram_example.py
The output is as follows:

In the preceding example, we created an array ...
Read now
Unlock full access