{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Simple Axes Divider 1\n\nSee also `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 Divider, Size\n\n\ndef label_axes(ax, text):\n    \"\"\"Place a label at the center of an Axes, and remove the axis ticks.\"\"\"\n    ax.text(.5, .5, text, transform=ax.transAxes,\n            horizontalalignment=\"center\", verticalalignment=\"center\")\n    ax.tick_params(bottom=False, labelbottom=False,\n                   left=False, labelleft=False)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Fixed Axes sizes; fixed paddings.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "fig = plt.figure(figsize=(6, 6))\nfig.suptitle(\"Fixed axes sizes, fixed paddings\")\n\n# Sizes are in inches.\nhoriz = [Size.Fixed(1.), Size.Fixed(.5), Size.Fixed(1.5), Size.Fixed(.5)]\nvert = [Size.Fixed(1.5), Size.Fixed(.5), Size.Fixed(1.)]\n\nrect = (0.1, 0.1, 0.8, 0.8)\n# Divide the Axes rectangle into a grid with sizes specified by horiz * vert.\ndiv = Divider(fig, rect, horiz, vert, aspect=False)\n\n# The rect parameter will actually be ignored and overridden by axes_locator.\nax1 = fig.add_axes(rect, axes_locator=div.new_locator(nx=0, ny=0))\nlabel_axes(ax1, \"nx=0, ny=0\")\nax2 = fig.add_axes(rect, axes_locator=div.new_locator(nx=0, ny=2))\nlabel_axes(ax2, \"nx=0, ny=2\")\nax3 = fig.add_axes(rect, axes_locator=div.new_locator(nx=2, ny=2))\nlabel_axes(ax3, \"nx=2, ny=2\")\nax4 = fig.add_axes(rect, axes_locator=div.new_locator(nx=2, nx1=4, ny=0))\nlabel_axes(ax4, \"nx=2, nx1=4, ny=0\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Axes sizes that scale with the figure size; fixed paddings.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "fig = plt.figure(figsize=(6, 6))\nfig.suptitle(\"Scalable axes sizes, fixed paddings\")\n\nhoriz = [Size.Scaled(1.5), Size.Fixed(.5), Size.Scaled(1.), Size.Scaled(.5)]\nvert = [Size.Scaled(1.), Size.Fixed(.5), Size.Scaled(1.5)]\n\nrect = (0.1, 0.1, 0.8, 0.8)\n# Divide the Axes rectangle into a grid with sizes specified by horiz * vert.\ndiv = Divider(fig, rect, horiz, vert, aspect=False)\n\n# The rect parameter will actually be ignored and overridden by axes_locator.\nax1 = fig.add_axes(rect, axes_locator=div.new_locator(nx=0, ny=0))\nlabel_axes(ax1, \"nx=0, ny=0\")\nax2 = fig.add_axes(rect, axes_locator=div.new_locator(nx=0, ny=2))\nlabel_axes(ax2, \"nx=0, ny=2\")\nax3 = fig.add_axes(rect, axes_locator=div.new_locator(nx=2, ny=2))\nlabel_axes(ax3, \"nx=2, ny=2\")\nax4 = fig.add_axes(rect, axes_locator=div.new_locator(nx=2, nx1=4, ny=0))\nlabel_axes(ax4, \"nx=2, nx1=4, ny=0\")\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
}