.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/ms_matplotlib/plot_spectrum_dia_ms_matplotlib.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_gallery_ms_matplotlib_plot_spectrum_dia_ms_matplotlib.py>`
        to download the full example code. or to run this example in your browser via Binder

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_ms_matplotlib_plot_spectrum_dia_ms_matplotlib.py:


Spectrum of Extracted DIA Data ms_matplotlib
=======================================

This example shows a spectrum from extracted data. No binning is applied.

.. GENERATED FROM PYTHON SOURCE LINES 7-30



.. image-sg:: /gallery/ms_matplotlib/images/sphx_glr_plot_spectrum_dia_ms_matplotlib_001.png
   :alt: Mass Spectrum
   :srcset: /gallery/ms_matplotlib/images/sphx_glr_plot_spectrum_dia_ms_matplotlib_001.png
   :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 .. code-block:: none


    <Axes: title={'center': 'Mass Spectrum'}, xlabel='mass-to-charge', ylabel='Intensity'>





|

.. code-block:: Python


    import pandas as pd
    import requests
    from io import StringIO

    pd.options.plotting.backend = "ms_matplotlib"

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

    df.plot(
        kind="spectrum",
        x="mz",
        y="int",
        custom_annotation="Annotation",
        annotate_mz=True,
        bin_method="none",
        annotate_top_n_peaks=5,
        aggregate_duplicates=True,
    )


.. rst-class:: sphx-glr-timing

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


.. _sphx_glr_download_gallery_ms_matplotlib_plot_spectrum_dia_ms_matplotlib.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: binder-badge

      .. image:: images/binder_badge_logo.svg
        :target: https://notebooks.gesis.org/binder/v2/gh/OpenMS/pyopenms_viz/gh_pages?filepath=notebooks/gallery/ms_matplotlib/plot_spectrum_dia_ms_matplotlib.ipynb
        :alt: Launch binder
        :width: 150 px

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_spectrum_dia_ms_matplotlib.ipynb <plot_spectrum_dia_ms_matplotlib.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_spectrum_dia_ms_matplotlib.py <plot_spectrum_dia_ms_matplotlib.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_spectrum_dia_ms_matplotlib.zip <plot_spectrum_dia_ms_matplotlib.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_