def f(x, y): return np.sqrt(x ** 2 + y ** 2) x = result[:, 0] y = result[:, 1] X, Y = np.meshgrid(x, y) Z = f(X, Y)