Note
Go to the end to download the full example code.
Using plot_multiple to plot several datasets on the same figure
In this example, we will display several Raman datasets on the same figure
using the plot_multiple helper. Unlike multiplot, which creates a grid of
panels, plot_multiple overlays several datasets on one shared axes. Several
options are available to customize that overlay.
Import spectrochempy as usual
import spectrochempy as scp
Load and inspect the data
Basic plot with categorical colors (cmap=None):

Preprocess: restrict and detrend
Restrict the region of interest (use floats for coordinate slicing):
Remove the drift with detrend:
B3 = scp.detrend(B2)
_ = B3.plot(cmap=None)

Select a subset of spectra for the overlay:

Overlay spectra with plot_multiple
Unlike multiplot (which creates a grid of panels), plot_multiple
overlays several 1D datasets on a shared axes. Here we use line rendering
with a vertical shift for visual separation:
datasets = list(B4)
_ = scp.plot_multiple(
datasets,
method="pen",
legend="best",
labels=["A", "B", "C", "D", "E"],
color=["black", "red", "green", "blue", "violet"],
lw=[1, 2.5, 1, 1, 1],
ls="-",
shift=1000,
)

Uncomment the following line to display all figures when running the script directly with Python.
# scp.show()
Total running time of the script: (0 minutes 1.037 seconds)