

.. _sphx_glr_gallery_lines_bars_and_markers_stem_plot.py:


=========
Stem Plot
=========

Example stem plot.




.. image:: /gallery/lines_bars_and_markers/images/sphx_glr_stem_plot_001.png
    :align: center





.. code-block:: python

    import matplotlib.pyplot as plt
    import numpy as np

    x = np.linspace(0.1, 2 * np.pi, 10)
    markerline, stemlines, baseline = plt.stem(x, np.cos(x), '-.')
    plt.setp(baseline, 'color', 'r', 'linewidth', 2)

    plt.show()

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



.. only :: html

 .. container:: sphx-glr-footer


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

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