Hi everyone,
> This is very strange; when I download the notebook and run it I indeed > see the error that you reported, however when I try to run the > following minimal example it succeeds: > > >> import numpy as np >> import matplotlib.pyplot >> import kwant >> >> graphene = kwant.lattice.general([[1, 0], [1/2, np.sqrt(3)/2]], # >> lattice vectors >> [[0, 0], [0, 1/np.sqrt(3)]]) # >> Coordinates of the sites >> >> zigzag_ribbon = kwant.Builder(kwant.TranslationalSymmetry([1, 0])) >> zigzag_ribbon[graphene.shape((lambda pos: abs(pos[1]) < 9), (0, 0))] = 0 >> zigzag_ribbon[graphene.neighbors(1)] = 1 >> >> print(kwant.__version__) >> kwant.plot(zigzag_ribbon); > > I'll investigate a bit more and report my results. > Found it! In Kwant 1.4.0a1 we tweaked Kwant's plotting so that sites from different families (sublattices) would use the colors from Matplotlib's color cycle by default. In the March Meeting tutorial notebooks there is a line: > %run matplotlib_setup.ipy that loads some custom matplotlib setup to make the plots look a bit better in the notebooks. Looking into 'matplotlib_setup.ipy' we see the following suspicious line: > mpl.rc('axes', prop_cycle=mpl.cycler('color', ['black'])) which was included to stop all the bandstructure plots being multicolored (because it's distracting), however because there are fewer colors than there are site families (2 site families in graphene) the color cycling in Kwant's plotter broke. This is a bug in Kwant, and I've opened an issue [1] on our bugtracker. I'll fix this today and it'll go into the v1.4.0 release (that we will make sometime between now and christmas). In the short term you can fix this in a couple of ways: + either downgrade to Kwant 1.3.3 + or change the offending line in 'matplotlib_setup.ipy' to: mpl.rc('axes', prop_cycle=mpl.cycler('color', ['black', 'black'])) + or wait until I push a change to the tutorial notebooks later today and then re-download them Thanks for the report, and happy kwanting! Joe [1]: https://gitlab.kwant-project.org/kwant/kwant/issues/257
signature.asc
Description: OpenPGP digital signature