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 withx_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_dataandmodesare incompatible, i. e.x_data.shape[0] != modes.shape[1].- ValueError
If lengths of
ticksandlabelsare incompatible, i. e.len(ticks) != len(labels).- ValueError
If length of
colorsis incompatible with number of modes, i. e.len(colors) != modes.shape[0].
Notes
If
matplotlibis not available, a warning is issued and the function plots nothing.If
ticksis given andlabelsis not, labels are filled asK1, K2, ....If
labelsis given andticksis not,labelsis ignored.If both
ticksandlabelsare not given, no high-symmetry points are marked.