Kwant Plotting issue
The working example below is taken directly from the tutorial FAQ, apart from the imports which have been added manually. Code has been run on io.
Short problem statement: kwant.plot does not always work consistently in particular for lattices with just a single lattice point defined
import kwant
from matplotlib import pyplot
syst = kwant.Builder()
primitive_vectors = [(1, 0), (0, 1)]
lat_a = kwant.lattice.Monatomic(primitive_vectors, offset=(0, 0))
lat_b = kwant.lattice.Monatomic(primitive_vectors, offset=(0.5, 0.5))
syst[lat_a(0, 0)] = 4
syst[lat_b(0, 0)] = 4
kwant.plot(syst);
On a fresh run (after restarting kernel), this results in the following:
First run
Subsequent runs result in one of the following two cases. Consecutive runs can yield different output at (what appears to be) random with no changes to code; the output is, at least, not simply given by "number of runs since kernel restart".
nth runs
If one more lattice site is added, so that the code takes the form
import kwant
from matplotlib import pyplot
syst = kwant.Builder()
primitive_vectors = [(1, 0), (0, 1)]
lat_a = kwant.lattice.Monatomic(primitive_vectors, offset=(0, 0))
lat_b = kwant.lattice.Monatomic(primitive_vectors, offset=(0.5, 0.5))
syst[lat_a(0, 0)] = 4
syst[lat_a(0, 1)] = 4 # THIS LINE IS NEW
syst[lat_b(0, 0)] = 4
kwant.plot(syst);
the first run gives the same result as the unmodified result (in that no plot at all is shown), but subsequent runs appear to consistently show the sites correctly.
This is most likely the cause of the tutorial FAQ bug reported in #263 (closed).