{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Ellipse with orientation arrow demo\n\nThis demo shows how to draw an ellipse with\nan orientation arrow (clockwise or counterclockwise).\nCompare this to the :doc:`Ellipse collection example\n</gallery/shapes_and_collections/ellipse_collection>`.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\n\nfrom matplotlib.markers import MarkerStyle\nfrom matplotlib.patches import Ellipse\nfrom matplotlib.transforms import Affine2D\n\n# Create a figure and axis\nfig, ax = plt.subplots(subplot_kw={\"aspect\": \"equal\"})\n\nellipse = Ellipse(\n    xy=(2, 4),\n    width=30,\n    height=20,\n    angle=35,\n    facecolor=\"none\",\n    edgecolor=\"b\"\n)\nax.add_patch(ellipse)\n\n# Plot an arrow marker at the end point of minor axis\nvertices = ellipse.get_co_vertices()\nt = Affine2D().rotate_deg(ellipse.angle)\nax.plot(\n    vertices[0][0],\n    vertices[0][1],\n    color=\"b\",\n    marker=MarkerStyle(\">\", \"full\", t),\n    markersize=10\n)\n# Note: To reverse the orientation arrow, switch the marker type from > to <.\n\nplt.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        ".. admonition:: References\n\n   The use of the following functions, methods, classes and modules is shown\n   in this example:\n\n   - `matplotlib.patches`\n   - `matplotlib.patches.Ellipse`\n\n"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.14.7"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}