dipc-cc / hubbard

Python tools for mean-field Hubbard models
https://dipc-cc.github.io/hubbard/
GNU Lesser General Public License v3.0
21 stars 8 forks source link

plot.Wavefunction marker size #124

Open leonardedens opened 2 years ago

leonardedens commented 2 years ago

plot.Wavefunction equates the marker size to the modulus of the complex coefficients fun: ax = self.axes.scatter(x, y, s=fun, c=phase, cmap=cmap, vmax=np.pi, vmin=-np.pi) For my systems, these markers end up being tiny: image A better way, in my opinion, would be to plot the normalized coefficients: ax = self.axes.scatter(x, y, s=tsf*fun/np.amax(fun), c=phase, cmap=cmap, vmax=np.pi, vmin=-np.pi) Hence, the sites of maximum localization will have a marker size of tsf. To fill a circle of radius 0.7 of the underlying geometry produced by hubbard.plot (line 200), one needs to determine the transformation tsf which converts from mpl.patches units to plt.scatter units, which will depend on the size of the sisl geometry. I tried doing this with PatchCollection.get_transform.transform(0.7), but it does not give the correct number. Setting tsf=250 approximately fills the circles at the maximally localized sites: image

sofiasanz commented 2 years ago

Hi Leonard, thank you very much for the idea. However I see this maybe a little problematic since the WF weights on the sites highly depend on the system. Also you can easily set your own scale by just simply multiplying your WF by some factor (instead of having it defined by default). For instance you can just:

p = plot.Wavefunction(H, 1000*wf, ...)

Maybe a better approach, that maintains this flexibility, could be to just add some scale argument that by default is something similar to your idea but the user can change it by just passing a different value.