Well, no one said that the boxes will be the same for different ranges of values ββalong the x axis;)
Here it is (see accepted answer):
from numpy import random from matplotlib import pyplot as plt data = [1 + random.randn(1000), random.randn(1000)] num_bins = 10 _n, bins, _patches = plt.hist(data, num_bins, label=['first', 'second']) plt.hist(data[1], bins, histtype='step', label=['second again']) plt.legend() plt.show()
giving:

source share