
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/shapes_and_collections/ellipse_arrow.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_ellipse_arrow.py>`
        to download the full example code.

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

.. _sphx_glr_gallery_shapes_and_collections_ellipse_arrow.py:


===================================
Ellipse with orientation arrow demo
===================================

This demo shows how to draw an ellipse with
an orientation arrow (clockwise or counterclockwise).
Compare this to the :doc:`Ellipse collection example
</gallery/shapes_and_collections/ellipse_collection>`.

.. GENERATED FROM PYTHON SOURCE LINES 11-45

.. code-block:: Python


    import matplotlib.pyplot as plt

    from matplotlib.markers import MarkerStyle
    from matplotlib.patches import Ellipse
    from matplotlib.transforms import Affine2D

    # Create a figure and axis
    fig, ax = plt.subplots(subplot_kw={"aspect": "equal"})

    ellipse = Ellipse(
        xy=(2, 4),
        width=30,
        height=20,
        angle=35,
        facecolor="none",
        edgecolor="b"
    )
    ax.add_patch(ellipse)

    # Plot an arrow marker at the end point of minor axis
    vertices = ellipse.get_co_vertices()
    t = Affine2D().rotate_deg(ellipse.angle)
    ax.plot(
        vertices[0][0],
        vertices[0][1],
        color="b",
        marker=MarkerStyle(">", "full", t),
        markersize=10
    )
    # Note: To reverse the orientation arrow, switch the marker type from > to <.

    plt.show()




.. image-sg:: /gallery/shapes_and_collections/images/sphx_glr_ellipse_arrow_001.png
   :alt: ellipse arrow
   :srcset: /gallery/shapes_and_collections/images/sphx_glr_ellipse_arrow_001.png, /gallery/shapes_and_collections/images/sphx_glr_ellipse_arrow_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 46-53

.. admonition:: References

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

   - `matplotlib.patches`
   - `matplotlib.patches.Ellipse`


.. _sphx_glr_download_gallery_shapes_and_collections_ellipse_arrow.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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