Hi Joe,
Thank you for help!
I found simpler answers to my questions.
kwant.plotter.current(sys, current, relwidth=0.05, density=1,
show=False)
pyplot.show(block=False)
Also, I found that current asymmetry was indeed there and it was caused
by numerical errors: the precision of the current calculation is higher
near the lead for which it is calculated, while the error may grow
significant near other lead(s). In my case, at some energies it is
symmetric, at some - not.
Best wishes,
Sergey
On 19/10/18 12:53, Joseph Weston wrote:
Hi Sergey,
1) This code gives a strange error:
The debugged program raised the exception unhandled TypeError
"streamplot() got an unexpected keyword argument 'start_points'"
File:
/home/sergey/.local/lib/python3.6/site-packages/kwant/plotter.py,
Line: 2164
which is strange since start_points is in the streamplot documentation
Ah, in the documentation [1] it does indeed mention "streamplot", but
we are actually referring to 'kwant.plotter.streamplot', not
matplotlib's one. I will modify the documentation so that the
distinction is clearer. Our version of streamplot includes things like
including the background color etc.
We don't currently provide a way to customize all the options of the
underlying calls to matplotlib, because this would be excessively
complicated. Luckily it is pretty simple to write your own wrapper
that you can customize:
def custom_current(syst, current):
field, box = kwant.plotter.interpolate_current(syst, current,
...) # your custom args here
# make grid for streamplot
X = np.linspace(*box[0], num=field.shape[0])
Y = np.linspace(*box[1], num=field.shape[1])
pyplot.streamplot(X, Y, field[:, :, 0], field[:, :, 1], ...)
# your custom args here
Make sure you post back to the mailing list if you find some heuristic
that makes decent plots!
2) How to make several plots be generated without manual closure of
the previous one? My command pyplot.show(block=False) does not
seem to work in this case.
You can pass a matplotlib axis to 'current' via the 'ax' parameter.
This will make the plotter draw into the axes that you provide.
You'll need to search on stackoverflow or look in the matplotlib docs
to find out how to do exactly what you want, because even though you
can totally define several plots, I'm not sure matplotlib can display
them simultaneously.
Happy Kwanting,
Joe
[1]:
https://kwant-project.org/doc/1/reference/generated/kwant.plotter.current