Interpolate 2d data-points to a given coordinate grid. This is useful when a 2d plot is needed but the data points are sparse or the coordinates are not integers values. In order to use it, one needs to build 3+2 arrays, i.e. the x, y, and z (the value) coordinates of the dataset and the grid. They can easily be feeded to the griddata function as follows: griddata((x,y), z, (grid_x, grid_y)).

The grid must be 2d and to build it a possible method is to use np.linspace (or any other sequence) and feed the griddata function with ..., (linspace_x[None,:], linspace_y[:,None]).

Griddata returns a 2d array that contains the interpolated value of z corresponding to the grid points.