diff --git a/doc/source/reference/kwant.plotter.rst b/doc/source/reference/kwant.plotter.rst index 8bfd67809d5ed44cb877000760795d7f54bb359b..7bc1dc635a366430eebe96387b3fb3659c5aef97 100644 --- a/doc/source/reference/kwant.plotter.rst +++ b/doc/source/reference/kwant.plotter.rst @@ -11,6 +11,7 @@ Plotting routines plot map + density current bands spectrum @@ -22,6 +23,7 @@ Helper functions :toctree: generated/ interpolate_current + interpolate_density sys_leads_sites sys_leads_hoppings sys_leads_pos diff --git a/doc/source/tutorial/operators.rst b/doc/source/tutorial/operators.rst index 99fef17fe0deeda4d9fe7a5b71e17c4885e0dcc8..ae397e3f55ce58656b7910724c5d78dadd8542d9 100644 --- a/doc/source/tutorial/operators.rst +++ b/doc/source/tutorial/operators.rst @@ -124,7 +124,7 @@ is the square matrix referred to previously. Below we can see colorplots of the above-calculated quantities. The array that is returned by evaluating a `~kwant.operator.Density` can be used directly with -`kwant.plotter.map`: +`kwant.plotter.density`: .. image:: /code/figure/spin_densities.* diff --git a/kwant/plotter.py b/kwant/plotter.py index 74c0730be15727af0acd2304bcd078fb19af962b..99ff47125d657deb071e4559c1621a3597d96eeb 100644 --- a/kwant/plotter.py +++ b/kwant/plotter.py @@ -1214,6 +1214,11 @@ def map(sys, value, colorbar=True, cmap=None, vmin=None, vmax=None, a=None, calling `~kwant.plotter.mask_interpolate` and show this pixmap using matplotlib. + This function is similar to `~kwant.plotter.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 `~kwant.plotter.density`. + Parameters ---------- sys : kwant.system.FiniteSystem or kwant.builder.Builder @@ -1269,6 +1274,10 @@ def map(sys, value, colorbar=True, cmap=None, vmin=None, vmax=None, a=None, - 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. + + See Also + -------- + kwant.plotter.density """ if not _p.mpl_available: @@ -2035,13 +2044,14 @@ def current(syst, current, relwidth=0.05, **kwargs): current density field where the current density is non-zero only on the straight lines that connect sites that are coupled by a hopping term. - To make this vector field easier to visualize and interpret at different + 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 an enhanced variant of matplotlib's streamplot. + This function is similar to `~kwant.plotter.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 `~kwant.plotter.map`. Parameters ---------- @@ -2062,6 +2072,9 @@ def current(syst, current, relwidth=0.05, **kwargs): fig : matplotlib figure A figure with the output if `ax` is not set, else None. + See Also + -------- + kwant.plotter.density """ with _common.reraise_warnings(4): return streamplot(*interpolate_current(syst, current, relwidth), @@ -2150,6 +2163,11 @@ def density(syst, density, relwidth=0.05, ------- fig : matplotlib figure A figure with the output if `ax` is not set, else None. + + See Also + -------- + kwant.plotter.current + kwant.plotter.map """ if not _p.mpl_available: raise RuntimeError("matplotlib was not found, but is required "