{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Axis Direction\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\n\nimport mpl_toolkits.axisartist as axisartist\n\n\ndef setup_axes(fig, pos):\n    ax = fig.add_subplot(pos, axes_class=axisartist.Axes)\n\n    ax.set_ylim(-0.1, 1.5)\n    ax.set_yticks([0, 1])\n\n    ax.axis[:].set_visible(False)\n\n    ax.axis[\"x\"] = ax.new_floating_axis(1, 0.5)\n    ax.axis[\"x\"].set_axisline_style(\"->\", size=1.5)\n\n    return ax\n\n\nplt.rcParams.update({\n    \"axes.titlesize\": \"medium\",\n    \"axes.titley\": 1.1,\n})\n\nfig = plt.figure(figsize=(10, 4))\nfig.subplots_adjust(bottom=0.1, top=0.9, left=0.05, right=0.95)\n\nax1 = setup_axes(fig, 251)\nax1.axis[\"x\"].set_axis_direction(\"left\")\n\nax2 = setup_axes(fig, 252)\nax2.axis[\"x\"].label.set_text(\"Label\")\nax2.axis[\"x\"].toggle(ticklabels=False)\nax2.axis[\"x\"].set_axislabel_direction(\"+\")\nax2.set_title(\"label direction=$+$\")\n\nax3 = setup_axes(fig, 253)\nax3.axis[\"x\"].label.set_text(\"Label\")\nax3.axis[\"x\"].toggle(ticklabels=False)\nax3.axis[\"x\"].set_axislabel_direction(\"-\")\nax3.set_title(\"label direction=$-$\")\n\nax4 = setup_axes(fig, 254)\nax4.axis[\"x\"].set_ticklabel_direction(\"+\")\nax4.set_title(\"ticklabel direction=$+$\")\n\nax5 = setup_axes(fig, 255)\nax5.axis[\"x\"].set_ticklabel_direction(\"-\")\nax5.set_title(\"ticklabel direction=$-$\")\n\nax7 = setup_axes(fig, 257)\nax7.axis[\"x\"].label.set_text(\"rotation=10\")\nax7.axis[\"x\"].label.set_rotation(10)\nax7.axis[\"x\"].toggle(ticklabels=False)\n\nax8 = setup_axes(fig, 258)\nax8.axis[\"x\"].set_axislabel_direction(\"-\")\nax8.axis[\"x\"].label.set_text(\"rotation=10\")\nax8.axis[\"x\"].label.set_rotation(10)\nax8.axis[\"x\"].toggle(ticklabels=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.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}