matchms.plotting.spectrum_plots module

matchms.plotting.spectrum_plots.plot_spectra_array(spectrums, n_cols: int = 2, peak_color='darkblue', dpi: int = 200, **spectrum_kws) matplotlib.axes._axes.Axes[source]

Mirror plot two MS/MS spectra.

Code is largely taken from package “spectrum_utils”.

Parameters
  • spectrums (list of matchms.Spectrum) – List of spectra to be plotted in a single figure.

  • n_cols – Number of spectra to be plotted per row. Default is 4.

  • spectrum_kws – Keyword arguments for plot_spectrum().

matchms.plotting.spectrum_plots.plot_spectra_mirror(spec_top, spec_bottom, ax: Optional[matplotlib.axes._axes.Axes] = None, **spectrum_kws) matplotlib.axes._axes.Axes[source]

Mirror plot two MS/MS spectra.

Code is largely taken from package “spectrum_utils”.

Parameters
  • spec_top (matchms.Spectrum) – The spectrum to be plotted on the top.

  • spec_bottom (matchms.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.

  • 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: Union[bool, str] = True, ax: Optional[matplotlib.axes._axes.Axes] = None, peak_color='teal', **plt_kwargs) matplotlib.axes._axes.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.

Returns

The matplotlib Axes instance on which the spectrum is plotted.

Return type

plt.Axes