Compute the 2d histogram of x and y.
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
xedges = [0, 1, 2, 3]
yedges = [0, 1, 2, 3, 4]
x = np.array([0, 0.1, 0.2, 1., 1.1, 2., 2.1])
y = np.array([0, 0.1, 0.2, 1., 1.1, 2., 3.3])
out = np.histogram2d(x, y, bins=(xedges, yedges))
plt.scatter(x, y)
plt.grid()