plt.clf()
x1 = np.random.normal(0, 10, 100000)
y1 = np.random.normal(0, 7, 100000) / 10.0
x2 = np.random.normal(-15, 7, 100000)
y2 = np.random.normal(-10, 10, 100000) / 10.0
x = np.concatenate([x1, x2])
y = np.concatenate([y1, y2])
counts, xbins, ybins = np.histogram2d(x, y, bins=100, normed=LogNorm())
plt.contour(counts.transpose(), extent=[xbins.min(), xbins.max(), ybins.min
    (), ybins.max()], linewidths=3, colors='black', linestyles='solid')
plt.show()
plt.savefig('pic_stack.png')
Контуры плотности чисел в Python