Histograms
In this lesson, learn how to visualize and interpret a dataset using a histogram.
StartKey Concepts
Review core concepts you need to learn to master this subject
Matplotlib Function To Create Histogram
Mean of a Dataset
Histogram Bins
What is a Histogram?
Histogram Bin Count
Histogram’s X and Y Axis
Matplotlib Function To Create Histogram
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.
Histograms
Lesson 1 of 1
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory