spyrit.misc.color.plot_hs

spyrit.misc.color.plot_hs(strategy, img, wav, suptitle=None, save_fig=False, results_root=None, data_folder=None, colorbar_format=None)[source]

Plot hyperspectral data with wavelength-aware colormaps.

Creates a grid of subplots showing each spectral band with a colormap that corresponds to the wavelength color. Each band is displayed with a custom colormap generated from the actual wavelength values.

Args:

strategy (str): Strategy type, either ‘slice’ or ‘bin’. Used for labeling.

img (np.ndarray): 3D numpy array with shape (height, width, n_wav) containing the hyperspectral data.

wav (array-like): Array of wavelength values in nanometers, length n_wav.

suptitle (str, optional): Super title for the entire figure. Defaults to None.

save_fig (bool, optional): Whether to save the figure as PDF. Defaults to False.

results_root (Path or str, optional): Root directory for saving figures. Required if save_fig is True. Defaults to None.

data_folder (Path or str, optional): Data folder name for organizing saved figures. Required if save_fig is True. Defaults to None.

colorbar_format (str, optional): printf-style format string used by matplotlib colorbar to format tick labels (e.g. ‘%.1f’). Defaults to ‘%.1f’.

Raises:

ValueError: If save_fig is True but results_root or data_folder is None.

Returns:

None: Displays the plot and optionally saves it.