kwant.plotter.
spectrum
(syst, x, y=None, params=None, mask=None, file=None, show=True, dpi=None, fig_size=None, ax=None)[source]¶Plot the spectrum of a Hamiltonian as a function of 1 or 2 parameters.
This function requires either matplotlib or plotly to be installed. The default engine uses matplotlib for plotting.
kwant.system.FiniteSystem
or callableIf a function, then it must take named parameters and return the Hamiltonian as a dense matrix.
(name, values)
Parameter to ham
that will be varied. Consists of the
parameter name, and a sequence of parameter values.
(name, values)
, optionalUsed for 3D plots (same as x
). If provided, then the cartesian
product of the x
values and these values will be used as a grid
over which to evaluate the spectrum.
The rest of the parameters to ham
, which will be kept constant.
Takes the parameters specified by x
and y
and returns True
if the spectrum should not be calculated for the given parameter
values.
The output file. If None, output will be shown instead. If plotly is selected as the engine, the filename has to end with a html extension.
For matplotlib engine, whether matplotlib.pyplot.show()
is to be
called, and the output is to be shown immediately.
For the plotly engine, a call to iplot(fig)
is made if
show is True.
Defaults to True for both engines.
Number of pixels per inch. If not set the matplotlib
default is
used.
Only for matplotlib engine. If the plotly engine is selected and
this argument is not None, then a RuntimeError will be triggered.
Figure size (width, height) in inches. If not set, the default
matplotlib
value is used.
Only for matplotlib engine. If the plotly engine is selected and
this argument is not None, then a RuntimeError will be triggered.
matplotlib.axes.Axes
instance or NoneIf ax is not None, no new figure is created, but the plot is done within the existing Axes ax. in this case, file, show, dpi and fig_size are ignored. Only for matplotlib engine. If the plotly engine is selected and this argument is not None, then a RuntimeError will be triggered.