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

.. only:: html

    .. meta::
        :keywords: codex

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

        :ref:`Go to the end <sphx_glr_download_gallery_shapes_and_collections_quad_bezier.py>`
        to download the full example code.

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

.. _sphx_glr_gallery_shapes_and_collections_quad_bezier.py:


============
Bezier curve
============

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

.. GENERATED FROM PYTHON SOURCE LINES 9-29

.. code-block:: Python


    import matplotlib.pyplot as plt

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

    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()




.. image-sg:: /gallery/shapes_and_collections/images/sphx_glr_quad_bezier_001.png
   :alt: The red point should be on the path
   :srcset: /gallery/shapes_and_collections/images/sphx_glr_quad_bezier_001.png, /gallery/shapes_and_collections/images/sphx_glr_quad_bezier_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 30-40

.. admonition:: References

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

   - `matplotlib.path`
   - `matplotlib.path.Path`
   - `matplotlib.patches`
   - `matplotlib.patches.PathPatch`
   - `matplotlib.axes.Axes.add_patch`


.. _sphx_glr_download_gallery_shapes_and_collections_quad_bezier.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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