{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Centered spines with arrows\n\nThis example shows a way to draw a \"math textbook\" style plot, where the\nspines (\"axes lines\") are drawn at ``x = 0`` and ``y = 0``, and have arrows at\ntheir ends.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\nfig, ax = plt.subplots()\n# Move the left and bottom spines to x = 0 and y = 0, respectively.\nax.spines[[\"left\", \"bottom\"]].set_position((\"data\", 0))\n# Hide the top and right spines.\nax.spines[[\"top\", \"right\"]].set_visible(False)\n\n# Draw arrows (as black triangles: \">k\"/\"^k\") at the end of the axes.  In each\n# case, one of the coordinates (0) is a data coordinate (i.e., y = 0 or x = 0,\n# respectively) and the other one (1) is an axes coordinate (i.e., at the very\n# right/top of the axes).  Also, disable clipping (clip_on=False) as the marker\n# actually spills out of the Axes.\nax.plot(1, 0, \">k\", transform=ax.get_yaxis_transform(), clip_on=False)\nax.plot(0, 1, \"^k\", transform=ax.get_xaxis_transform(), clip_on=False)\n\n# Some sample data.\nx = np.linspace(-0.5, 1., 100)\nax.plot(x, np.sin(x*np.pi))\n\nplt.show()"
      ]
    }
  ],
  "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
}