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

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

.. _sphx_glr_gallery_api_quad_bezier.py:


============
Bezier Curve
============

This example showcases the PathPatch object to create a Bezier polycurve path
patch.




.. image:: /gallery/api/images/sphx_glr_quad_bezier_001.png
    :class: sphx-glr-single-img





.. code-block:: python


    import matplotlib.path as mpath
    import matplotlib.patches as mpatches
    import matplotlib.pyplot as plt

    Path = mpath.Path

    fig, ax = plt.subplots()
    pp1 = mpatches.PathPatch(
        Path([(0, 0), (1, 0), (1, 1), (0, 0)],
             [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY]),
        fc="none", transform=ax.transData)

    ax.add_patch(pp1)
    ax.plot([0.75], [0.25], "ro")
    ax.set_title('The red point should be on the path')

    plt.show()


.. _sphx_glr_download_gallery_api_quad_bezier.py:


.. only :: html

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



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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