xx, yy = pylab.meshgrid(pylab.linspace(-3, 3, 101), pylab.linspace(-3, 3, 111))
zz = pylab.zeros(xx.shape)
for i in range(xx.shape[0]):
    for j in range(xx.shape[1]):
        zz[i, j] = func(xx[i, j], yy[i, j])
pylab.pcolor(xx, yy, zz)
pylab.colorbar()
pylab.show()
How to plot 3D function as 2D colormap in python?