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

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

.. _sphx_glr_gallery_lines_bars_and_markers_joinstyle.py:


===========
Join styles
===========

Illustrate the three different join styles.



.. code-block:: python


    import numpy as np
    import matplotlib.pyplot as plt


    def plot_angle(ax, x, y, angle, style):
        phi = np.radians(angle)
        xx = [x + .5, x, x + .5*np.cos(phi)]
        yy = [y, y, y + .5*np.sin(phi)]
        ax.plot(xx, yy, lw=8, color='blue', solid_joinstyle=style)
        ax.plot(xx[1:], yy[1:], lw=1, color='black')
        ax.plot(xx[1::-1], yy[1::-1], lw=1, color='black')
        ax.plot(xx[1:2], yy[1:2], 'o', color='red', markersize=3)
        ax.text(x, y + .2, '%.0f degrees' % angle)

    fig, ax = plt.subplots()
    ax.set_title('Join style')

    for x, style in enumerate((('miter', 'round', 'bevel'))):
        ax.text(x, 5, style)
        for i in range(5):
            plot_angle(ax, x, i, pow(2.0, 3 + i), style)

    ax.set_xlim(-.5, 2.75)
    ax.set_ylim(-.5, 5.5)
    plt.show()




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




------------

References
""""""""""

The use of the following functions, methods, classes and modules is shown
in this example:



.. code-block:: python


    import matplotlib
    matplotlib.axes.Axes.plot
    matplotlib.pyplot.plot







.. _sphx_glr_download_gallery_lines_bars_and_markers_joinstyle.py:


.. only :: html

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



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: joinstyle.ipynb <joinstyle.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>`_
