im = ax[2].imshow(np.ma.masked_where(hist == 0, hist).T, interpolation=
    'none', origin='lower', extent=extent)
ax[0].set_title('mpl')
ax[1].set_title('numpy')
ax[2].set_title('numpy masked')
python matplotlib plot hist2d with normalised masked numpy array