pyopenms.plotting.plot_spectrum(spectrum: MSSpectrum, color_ions: bool = True, annotate_ions: bool = True, matched_peaks: Set | None = None, annot_kws: Dict | None = None, mirror_intensity: bool = False, grid: bool | str = True, ax=None)#

Plot an MS/MS spectrum.

  • spectrum (MSSpectrum) – The spectrum to be plotted. Reads annotations from the first StringDataArray if it has the same length as the number of peaks.

  • color_ions (bool, optional) – Flag indicating whether to color annotated fragment ions. The default is True.

  • annotate_ions (bool, optional) – Flag indicating whether to annotate fragment ions. The default is True.

  • matched_peaks (Optional[Set], optional) – Indices of matched peaks in a spectrum alignment.

  • annot_kws (Optional[Dict], optional) – Keyword arguments for ax.text to customize peak annotations.

  • mirror_intensity – Flag indicating whether to flip the intensity axis or not.

:type mirror_intensity : bool, optional

  • grid (Union[bool, str], optional) – 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.

:type ax : Optional[plt.Axes], optional

:return The matplotlib Axes instance on which the spectrum is plotted. :rtype: plt.Axes