magnopy.io.plot_dispersion#

magnopy.io.plot_dispersion(modes, x_data=None, ticks=None, labels=None, output_filename=None, ylabel='Energy', colors=None) None[source]#

Plot dispersion curves.

Input data (modes) are expected in meV. meV converted into THz for the twin axis via

\[E = h \nu\]
Parameters:
modes(M,) or (N, M) array-like

Dispersion data, Either one or \(N\) modes with \(M\) points each.

x_data(M,) array-like, optional

Abscissa (x axis) data. If None, then integer indices would be used.

ticks(K,) array-like, optional

Positions of high-symmetry points along the x axis. If None, then no high-symmetry points would be marked. coordinates are interpreted together with x_data, whether the latter is provided or not.

labels(K,) list of str, optional

Labels of high-symmetry points.

output_filenamestr, optional

Name of the file for saving the image. If None, then the graph would be opened in the interactive matplotlib window.

ylabelstr, default "Energy"

Label for the ordinate (y axis). Do not include units, units are included automatically - meV for primary axis and THz for twin axis.

colors"random" or (N,) array-like, optional

Colors for each mode. If "random", random colors are assigned. If None, then a default color is used for all modes.

Raises:
ValueError

If shapes of x_data and modes are incompatible, i. e. x_data.shape[0] != modes.shape[1].

ValueError

If lengths of ticks and labels are incompatible, i. e. len(ticks) != len(labels).

ValueError

If length of colors is incompatible with number of modes, i. e. len(colors) != modes.shape[0].

Notes

If matplotlib is not available, a warning is issued and the function plots nothing.

  • If ticks is given and labels is not, labels are filled as K1, K2, ....

  • If labels is given and ticks is not, labels is ignored.

  • If both ticks and labels are not given, no high-symmetry points are marked.