How to convert two datasets X and Y to histograms whose x-axes/index are identical, instead of the x-axis range of variable X being collectively lower or higher than the x-axis range of variable Y (like how the code below generates)? I would like the numpy histogram output values to be ready to plot in a shared histogram-plot afterwards.
import numpy as np
from numpy.random import randn
n = 100 # number of bins
#datasets
X = randn(n)*.1
Y = randn(n)*.2
#empirical distributions
a = np.histogram(X,bins=n)
b = np.histogram(Y,bins=n)