import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.colors import LogNorm
import numpy as np
x, y, z = np.loadtxt('data.txt', unpack=True)
N = int(len(z) ** 0.5)
z = z.reshape(N, N)
plt.imshow(z + 10, extent=(np.amin(x), np.amax(x), np.amin(y), np.amax(y)),
    cmap=cm.hot, norm=LogNorm())
plt.colorbar()
plt.show()
How to plot a density map in python?