mvpa2.misc.plot.flat_surf.griddata

mvpa2.misc.plot.flat_surf.griddata(x, y, z, xi, yi, interp=u'nn')

Interpolates from a nonuniformly spaced grid to some other grid.

Fits a surface of the form z = f(x, y) to the data in the (usually) nonuniformly spaced vectors (x, y, z), then interpolates this surface at the points specified by (xi, yi) to produce zi.

Parameters:

x, y, z : 1d array_like

Coordinates of grid points to interpolate from.

xi, yi : 1d or 2d array_like

Coordinates of grid points to interpolate to.

interp : string key from {‘nn’, ‘linear’}

Interpolation algorithm, either ‘nn’ for natural neighbor, or ‘linear’ for linear interpolation.

Returns:

2d float array

Array of values interpolated at (xi, yi) points. Array will be masked is any of (xi, yi) are outside the convex hull of (x, y).

Notes

If interp is ‘nn’ (the default), uses natural neighbor interpolation based on Delaunay triangulation. This option is only available if the mpl_toolkits.natgrid module is installed. This can be downloaded from https://github.com/matplotlib/natgrid. The (xi, yi) grid must be regular and monotonically increasing in this case.

If interp is ‘linear’, linear interpolation is used via matplotlib.tri.LinearTriInterpolator.

Instead of using griddata, more flexible functionality and other interpolation options are available using a matplotlib.tri.Triangulation and a matplotlib.tri.TriInterpolator.