a = np.random.random(100) * 0.5
b = 1 - np.random.normal(size=100) * 0.1
bins = np.histogram(np.hstack((a, b)), bins=40)[1]
plt.hist(a, bins)
Matplotlib: How to make two histograms have the same bin width?