kwant.plotter.mask_interpolate(coords, values, a=None, method='nearest', oversampling=3)[source]

Interpolate a scalar function in vicinity of given points.

Create a masked array corresponding to interpolated values of the function at points lying not further than a certain distance from the original data points provided.


An array with site coordinates.


An array with the values from which the interpolation should be built.

afloat, optional

Reference length. If not given, it is determined as a typical nearest neighbor distance.

methodstring, optional

Passed to scipy.interpolate.griddata: “nearest” (default), “linear”, or “cubic”

oversamplinginteger, optional

Number of pixels per reference length. Defaults to 3.

array2d NumPy array

The interpolated values.

min, maxvectors

The real-space coordinates of the two extreme ([0, 0] and [-1, -1]) points of array.


  • min and max are chosen such that when plotting a system on a square lattice and oversampling is set to an odd integer, each site will lie exactly at the center of a pixel of the output array.

  • When plotting a system on a square lattice and method is “nearest”, it makes sense to set oversampling to 1. Then, each site will correspond to exactly one pixel in the resulting array.

Previous topic


Next topic

3.5. kwant.solvers – Library of solvers

This Page