kwant.plotter.scalarplot#
- kwant.plotter.scalarplot(field, box, cmap=None, colorbar=True, file=None, show=True, dpi=None, fig_size=None, ax=None, vmin=None, vmax=None, background='#e0e0e0')[source]#
Draw a scalar field in Kwant style
Internally, this routine uses matplotlib’s imshow.
- Parameters:
field (2d arraylike of float) – 2d scalar field to plot.
box (pair of pair of float) – the realspace extents of
field
: ((x0, x1), (y0, y1))cmap (colormap, optional) – Colormap for the background color plot. When not set the colormap “kwant_red” is used by default.
colorbar (bool, default: True) – Whether to show a colorbar if a colormap is used. Ignored if ax is provided.
file (string or file object, optional) – The output file. If not provided, output will be shown instead.
show (bool, default: True) – Whether
matplotlib.pyplot.show()
is to be called, and the output is to be shown immediately.dpi (float, optional) – Number of pixels per inch. If not set the
matplotlib
default is used.fig_size (tuple, optional) – Figure size
(width, height)
in inches. If not set, the defaultmatplotlib
value is used.ax (
matplotlib.axes.Axes
instance, optional) – Ifax
is provided, no new figure is created, but the plot is done within the existing Axesax
. in this case,file
,show
,dpi
andfig_size
are ignored.vmin (float, optional) – The lower/upper saturation limit for the colormap.
vmax (float, optional) – The lower/upper saturation limit for the colormap.
background (matplotlib color spec) – Areas outside the system are filled with this color.
- Returns:
fig – A figure with the output if
ax
is not set, else None.- Return type:
matplotlib figure