Spectrum ms_plotly#

This example shows a spectrum. We can add the ion_annotation and sequence annotation by specifying these columns.

501001502000510152025
Tracea+b3+c5+y9+z3+x4+Mass Spectrummass-to-chargeIntensity100.5332c5+DMAGCH74.1324b3+DMAGCH200.4232x4+DMAGCH160.2y9+DMAGCH101.545c5+DMAGCH


import pandas as pd
from io import StringIO
import requests

pd.options.plotting.backend = "ms_plotly"

# download the file for example plotting
url = (
    "https://github.com/OpenMS/pyopenms_viz/releases/download/v0.1.5/TestSpectrumDf.tsv"
)
response = requests.get(url)
response.raise_for_status()  # Check for any HTTP errors
df = pd.read_csv(StringIO(response.text), sep="\t")

# mirror a reference spectrum with ion and sequence annoations
df.plot(
    x="mz",
    y="intensity",
    kind="spectrum",
    ion_annotation="ion_annotation",
    sequence_annotation="sequence",
)

Total running time of the script: (0 minutes 0.102 seconds)

Gallery generated by Sphinx-Gallery