{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Spine placement\n\nThe position of the axis spines can be influenced using `~.Spine.set_position`.\n\nNote: If you want to obtain arrow heads at the ends of the axes, also check\nout the :doc:`/gallery/spines/centered_spines_with_arrows` example.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "x = np.linspace(0, 2*np.pi, 100)\ny = 2 * np.sin(x)\n\nfig, ax_dict = plt.subplot_mosaic(\n    [['center', 'zero'],\n     ['axes', 'data']]\n)\nfig.suptitle('Spine positions')\n\n\nax = ax_dict['center']\nax.set_title(\"'center'\")\nax.plot(x, y)\nax.spines[['left', 'bottom']].set_position('center')\nax.spines[['top', 'right']].set_visible(False)\n\nax = ax_dict['zero']\nax.set_title(\"'zero'\")\nax.plot(x, y)\nax.spines[['left', 'bottom']].set_position('zero')\nax.spines[['top', 'right']].set_visible(False)\n\nax = ax_dict['axes']\nax.set_title(\"'axes' (0.2, 0.2)\")\nax.plot(x, y)\nax.spines.left.set_position(('axes', 0.2))\nax.spines.bottom.set_position(('axes', 0.2))\nax.spines[['top', 'right']].set_visible(False)\n\nax = ax_dict['data']\nax.set_title(\"'data' (1, 2)\")\nax.plot(x, y)\nax.spines.left.set_position(('data', 1))\nax.spines.bottom.set_position(('data', 2))\nax.spines[['top', 'right']].set_visible(False)\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
}