matchms.plotting.spectrum_plots module
- matchms.plotting.spectrum_plots.plot_spectra_mirror(spec_top, spec_bottom, ax: Axes | None = None, color_top='darkblue', color_bottom='teal', **spectrum_kws) Axes[source]
Mirror plot two MS/MS spectra.
Code is largely taken from package “spectrum_utils”.
- Parameters:
spec_top (matchms.Spectrum.Spectrum.Spectrum) – The spectrum to be plotted on the top.
spec_bottom (matchms.Spectrum.Spectrum.Spectrum) – The spectrum to be plotted on the bottom.
ax – Axes instance on which to plot the spectrum. If None the current Axes instance is used.
color_top – Set color of peaks in top spectrum.
color_bottom – Set color of peaks in bottom spectrum.
spectrum_kws – Keyword arguments for plot_spectrum().
- Returns:
The matplotlib Axes instance on which the spectra are plotted.
- Return type:
plt.Axes
- matchms.plotting.spectrum_plots.plot_spectrum(spectrum, annotate_ions: bool = False, mirror_intensity: bool = False, grid: bool | str = True, ax: Axes = None, peak_color='teal', min_mz: float = None, max_mz: float = None, **plt_kwargs) Axes[source]
Plot a single MS/MS spectrum.
Code is largely taken from package “spectrum_utils”.
- Parameters:
spectrum (matchms.Spectrum) – The spectrum to be plotted.
annotate_ions – Flag indicating whether or not to annotate fragment using peak comments (if present in the spectrum). The default is True.
mirror_intensity – Flag indicating whether to flip the intensity axis or not.
grid – Draw grid lines or not. Either a boolean to enable/disable both major and minor grid lines or ‘major’/’minor’ to enable major or minor grid lines respectively.
ax – Axes instance on which to plot the spectrum. If None the current Axes instance is used.
peak_color – Set color of peaks in plot.
min_mz – Set lower limit of the plots x-axis to min_mz. Default is None.
max_mz – Set upper limit of the plots x-axis to min_mz. Default is None.
- Returns:
The matplotlib Axes instance on which the spectrum is plotted.
- Return type:
plt.Axes