Dear Christoph and Gillherm, I think that is indeed a bug. I simplified the code to minimum, and could not find any error or explanation. My matplotlib is 3.4.3 kwant 1.4.3 installed on windows.
Regards, Adel ################################################################ import kwant from matplotlib import pyplot lat1 = kwant.lattice.cubic(a=1,name='first') lat2 = kwant.lattice.cubic(a=1,name='second') syst = kwant.Builder() syst[(lat1(x, y, z) for x in range(5) for y in range(5) for z in [15])] = 0 syst[(lat2(x, y, z) for x in range(5) for y in range(5) for z in [5])] = 0 def Color(site): if site.family == lat1: return 'red' else: return 'green' kwant.plot(syst, site_color=Color) On Mon, Apr 17, 2023 at 7:52 PM Christoph Groth <christoph.gr...@cea.fr> wrote: > guilhermewe...@gmail.com wrote: > > > The following code completely reproduces the bug, and the #sys shows > > how it deslocates. Taking of some f the lattices also doesn't fix, it > > can be checked. > > Now I understand what you meant: in the figure you linked to previously, > the color of the single “stray” site does not match the color of the > “humps” with which it shares the same site family. > > Before you sent the example I wrongly believed that your issue might be > about the sorting order of sites with regards to which there used to be > some problems. However, I would be surprised if the color issue you > observe was caused by matplotlib. It should be able to plot a circle in > the color it is told to do. > > So that’s indeed a strange problem! > > However, I cannot reproduce it. In your script, I uncommented the line > marked with “bug?” and obtain the attached plot. The separate site has > the same color (here: yellow) as the two humps that are made with > lat_sc, as it should be. > > This is with Python 3.9, Kwant 1.4.3, and matplotlib 3.3.4, running on > Debian stable. What is your environment? > > Christoph > -- Abbout Adel