kwant.plotter.map

Contents

kwant.plotter.map#

kwant.plotter.map(sys, value, colorbar=True, cmap=None, vmin=None, vmax=None, a=None, method='nearest', oversampling=3, num_lead_cells=0, file=None, show=True, dpi=None, fig_size=None, ax=None, pos_transform=None, background='#e0e0e0')[source]#

Show interpolated map of a function defined for the sites of a system.

Create a pixmap representation of a function of the sites of a system by calling mask_interpolate and show this pixmap using matplotlib.

This function is similar to density, but is more suited to the case where you want site-level resolution of the quantity that you are plotting. If your system has many sites you may get more appealing plots by using density.

Parameters:
  • sys (kwant.system.FiniteSystem or kwant.builder.Builder) – The system for whose sites value is to be plotted.

  • value (function or list) – Function which takes a site and returns a value if the system is a builder, or a list of function values for each system site of the finalized system.

  • colorbar (bool, optional) – Whether to show a color bar if numerical data has to be plotted. Defaults to True. If ax is provided, the colorbar is never plotted.

  • cmap (matplotlib color map or None) – The color map used for sites and optionally hoppings, if None, matplotlib default is used.

  • vmin (float, optional) – The lower saturation limit for the colormap; values returned by value which are smaller than this will saturate

  • vmax (float, optional) – The upper saturation limit for the colormap; valued returned by value which are larger than this will saturate

  • a (float, optional) – Reference length. If not given, it is determined as a typical nearest neighbor distance.

  • method (string, optional) – Passed to scipy.interpolate.griddata: “nearest” (default), “linear”, or “cubic”

  • oversampling (integer, optional) – Number of pixels per reference length. Defaults to 3.

  • num_lead_cells (integer, optional) – number of lead unit cells that should be plotted to indicate the position of leads. Defaults to 0.

  • file (string or file object or None) – The output file. If None, output will be shown instead.

  • show (bool) – Whether matplotlib.pyplot.show() is to be called, and the output is to be shown immediately. Defaults to True.

  • ax (matplotlib.axes.Axes instance or None) – If ax is not None, no new figure is created, but the plot is done within the existing Axes ax. in this case, file, show, dpi and fig_size are ignored.

  • pos_transform (function or None) – Transformation to be applied to the site position.

  • background (matplotlib color spec) – Areas without sites are filled with this color.

Returns:

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

Return type:

matplotlib figure

Notes

  • 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.