import numpy as n import matplotlib.pyplot as pl # create data x = n.random.normal(size=50000) y = x * 3 + n.random.normal(size=50000) # construct histogram 2D: data, nbins, color_map pl.hist2d(x, y, bins=(100, 100), cmap=pl.cm.jet) # show z-scale pl.colorbar() pl.show()