Key Concepts

Review core concepts you need to learn to master this subject

Matplotlib Function To Create Histogram

import numpy as np from matplotlib import pyplot as plt # numpy array data_array = np.array([1,1,1,1,1,2,3,3,3,4,4,5,5,6,7]) # plot histogram plt.hist(data_array, range = (1,7), bins = 7)

In Python, the pyplot.hist() function in the Matplotlib pyplot library can be used to plot a histogram. The function accepts a NumPy array, the range of the dataset, and the number of bins as input.

Lesson 1 of 1

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo