stackplot#
- torchspin.stackplot(x, y, scale='maxabs', step=1.5, labels=None, colors=None, *, ax=None)[source]#
Plot spectra in a vertically stacked arrangement.
- Parameters:
x (ndarray) – Horizontal axis values, shape
(N,).y (ndarray) – Data matrix. If shape
(N, M), plots M slices. If shape(M, N)(i.e.y.shape[0] == len(x)isFalsebuty.shape[1] == len(x)), the matrix is auto-transposed.Scaling mode:
'maxabs'(default): normalize each slice to its max absolute value'int': normalize by integral'dint': normalize by double integral'none': no scaling['maxabs', factor]: apply additional scale factor
step (float | ndarray) – Vertical spacing. If scalar, used as a multiplier of the max amplitude across slices. If an array of length
M, explicit y-positions for each slice.labels (list | None) – Labels for each slice (shown on y-axis ticks).
colors (str | ndarray | None) – Colormap name (string), single RGB color (3-element), or
(M, 3)color array.ax – Matplotlib axes. If
None, a new figure is created.
- Returns:
fig – Matplotlib figure.
ax – Matplotlib axes.
lines – List of line objects.