{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Make room for ylabel using axes_grid\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\n\nfrom mpl_toolkits.axes_grid1 import make_axes_locatable\nfrom mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable\n\nfig = plt.figure()\nax = fig.add_axes((0, 0, 1, 1))\n\nax.set_yticks([0.5], labels=[\"very long label\"])\n\nmake_axes_area_auto_adjustable(ax)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "fig = plt.figure()\nax1 = fig.add_axes((0, 0, 1, 0.5))\nax2 = fig.add_axes((0, 0.5, 1, 0.5))\n\nax1.set_yticks([0.5], labels=[\"very long label\"])\nax1.set_ylabel(\"Y label\")\n\nax2.set_title(\"Title\")\n\nmake_axes_area_auto_adjustable(ax1, pad=0.1, use_axes=[ax1, ax2])\nmake_axes_area_auto_adjustable(ax2, pad=0.1, use_axes=[ax1, ax2])"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "fig = plt.figure()\nax1 = fig.add_axes((0, 0, 1, 1))\ndivider = make_axes_locatable(ax1)\n\nax2 = divider.append_axes(\"right\", \"100%\", pad=0.3, sharey=ax1)\nax2.tick_params(labelleft=False)\nfig.add_axes(ax2)\n\ndivider.add_auto_adjustable_area(use_axes=[ax1], pad=0.1,\n                                 adjust_dirs=[\"left\"])\ndivider.add_auto_adjustable_area(use_axes=[ax2], pad=0.1,\n                                 adjust_dirs=[\"right\"])\ndivider.add_auto_adjustable_area(use_axes=[ax1, ax2], pad=0.1,\n                                 adjust_dirs=[\"top\", \"bottom\"])\n\nax1.set_yticks([0.5], labels=[\"very long label\"])\n\nax2.set_title(\"Title\")\nax2.set_xlabel(\"X - Label\")\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
}