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

    Click :ref:`here <sphx_glr_download_gallery_lines_bars_and_markers_line_styles_reference.py>` to download the full example code
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_lines_bars_and_markers_line_styles_reference.py:


====================
Line-style reference
====================

Reference for line-styles included with Matplotlib.




.. image:: /gallery/lines_bars_and_markers/images/sphx_glr_line_styles_reference_001.png
    :class: sphx-glr-single-img





.. code-block:: python

    import numpy as np
    import matplotlib.pyplot as plt


    color = 'cornflowerblue'
    points = np.ones(5)  # Draw 5 points for each line
    text_style = dict(horizontalalignment='right', verticalalignment='center',
                      fontsize=12, fontdict={'family': 'monospace'})


    def format_axes(ax):
        ax.margins(0.2)
        ax.set_axis_off()


    # Plot all line styles.
    fig, ax = plt.subplots()

    linestyles = ['-', '--', '-.', ':']
    for y, linestyle in enumerate(linestyles):
        ax.text(-0.1, y, repr(linestyle), **text_style)
        ax.plot(y * points, linestyle=linestyle, color=color, linewidth=3)
        format_axes(ax)
        ax.set_title('line styles')

    plt.show()


.. _sphx_glr_download_gallery_lines_bars_and_markers_line_styles_reference.py:


.. only :: html

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



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
