import matplotlib.pyplot import numpy as np import scipy.stats N = 100000 x = np.random.normal(0, 1, N) y = 0.5 * x + 0.8660254*np.random.normal(0, 1, N) xp = np.array(list(map(scipy.stats.norm.cdf, x))) yp = np.array(list(map(scipy.stats.norm.cdf, y))) xp2 = np.array(list(map(lambda x: int(100*x), xp))) yp2 = np.array(list(map(lambda x: int(100*x), yp))) foo = np.zeros(100) bar = np.zeros(100) for i in range(len(xp2)): foo[xp2[i]] += yp2[i] bar[xp2[i]] += 1 baz = foo/bar matplotlib.pyplot.scatter([i for i in range(100)], baz) matplotlib.pyplot.show()