spectrochempy.plot_baseline

plot_baseline(original, baseline, corrected, *, regions=None, show_regions=False, region_color=None, region_alpha=None, ax=None, clear=True, show=True, linewidth=1.0, linestyle='-', baseline_linestyle='-', baseline_color='tab:orange', **kwargs)[source]

Plot original, baseline, and corrected spectra in two stacked axes.

Parameters:
  • original (NDDataset) – Original spectra (1D or 2D).

  • baseline (NDDataset) – Computed baseline (same shape as original).

  • corrected (NDDataset) – Baseline-corrected spectra (same shape as original).

  • regions (iterable of (x0, x1) pairs, optional) – Baseline fitting regions to highlight on the plot. Each region is a pair of x-coordinates in physical units.

  • show_regions (bool, optional) – If True and regions provided, display region spans on the top axis. Default is False.

  • region_color (str, optional) – Face color for region spans. If None, uses preferences.baseline_region_color.

  • region_alpha (float, optional) – Transparency for region spans (0-1). If None, uses preferences.baseline_region_alpha.

  • ax (None) – Must be None. This function creates its own two-axes figure.

  • clear (bool, optional) – If True, clear axes before plotting. Default is True.

  • show (bool, optional) – If True, display the figure. Default is True.

  • linewidth (float, optional) – Line width for all lines. Default is 1.0.

  • linestyle (str, optional) – Line style for original and corrected spectra. Default is β€œ-β€œ.

  • baseline_linestyle (str, optional) – Line style for baseline curves. Default is β€œ-β€œ.

  • baseline_color (str, optional) – Color for baseline curves. Default is β€œtab:orange”.

  • **kwargs – Additional keyword arguments (reserved for future use).

Returns:

tuple – (ax_top, ax_bottom) matplotlib axes.

Raises:

ValueError – If ax is provided (this function creates its own axes). If input shapes do not match. If input ndim is not 1 or 2.