kwant.plotter.density

Contents

kwant.plotter.density#

kwant.plotter.density(syst, density, relwidth=0.05, **kwargs)[source]#

Show an interpolated density defined on the sites of a system.

The system sites, together with a scalar per site defines a “discrete” density field that is non-zero only on the sites.

To make this scalar field easier to visualize and interpret at different length scales, it is smoothed by convoluting it with the bell-shaped bump function f(r) = max(1 - (2*r / width)**2, 0)**2. The bump width is determined by the relwidth parameter.

This routine samples the smoothed field on a regular (square or cubic) grid and displays it using matplotlib’s imshow.

This function is similar to map, but generally gives more appealing visual results when used on systems with many sites. If you want site-level resolution you may be better off using map.

This is a convenience function that is equivalent to scalarplot(*interpolate_density(syst, density, relwidth), **kwargs). The longer form makes it possible to tweak additional options of interpolate_density.

Parameters:
  • syst (kwant.system.FiniteSystem) – The system for which to plot density.

  • density (sequence of float) – Sequence of values defining density on each site of the system. Ordered in the same way as syst.sites. This typically will be the result of evaluating a Density operator.

  • relwidth (float or None) – Relative width of the bumps used to smooth the field, as a fraction of the length of the longest side of the bounding box.

  • **kwargs (various) – Keyword args to be passed verbatim to scalarplot.

Returns:

fig – A figure with the output if ax is not set, else None.

Return type:

matplotlib figure