{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Subplots spacings and margins\n\nAdjusting the spacing of margins and subplots using `.pyplot.subplots_adjust`.\n\n<div class=\"alert alert-info\"><h4>Note</h4><p>There is also a tool window to adjust the margins and spacings of displayed\n   figures interactively.  It can be opened via the toolbar or by calling\n   `.pyplot.subplot_tool`.</p></div>\n\n.. redirect-from:: /gallery/subplots_axes_and_figures/subplot_toolbar\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\n# Fixing random state for reproducibility\nnp.random.seed(19680801)\n\nplt.subplot(211)\nplt.imshow(np.random.random((100, 100)))\nplt.subplot(212)\nplt.imshow(np.random.random((100, 100)))\n\nplt.subplots_adjust(bottom=0.1, right=0.8, top=0.9)\ncax = plt.axes((0.85, 0.1, 0.075, 0.8))\nplt.colorbar(cax=cax)\n\nplt.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        ".. tags::\n\n   component: subplot\n   plot-type: imshow\n   level: beginner\n\n"
      ]
    }
  ],
  "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
}