{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Two subplots using pyplot\n\nA typical pyplot usage pattern is to create subplots incrementally through\n`~.pyplot.subplot`.\n\nThe three-digit number passed to `~.pyplot.subplot` specifies the position of\nthe subplot in the grid of subplots. ``211`` means \"in a grid of 2 rows and 1 column,\ncreate this subplot in the 1st position\". ``212`` likewise means \"in a grid of 2\nrows and 1 column, create this subplot in the 2nd position\".\n\nAfter calling ``subplot()`` all following pyplot commands will modify that subplot\nuntil a new subplot is created.\n\n.. redirect-from:: /gallery/pyplots/pyplot_three\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\n\ndef f(t):\n    return np.exp(-t) * np.cos(2*np.pi*t)\n\n\nt1 = np.arange(0.0, 5.0, 0.1)\nt2 = np.arange(0.0, 5.0, 0.02)\n\nplt.figure()\nplt.subplot(211)\nplt.plot(t1, f(t1), color='tab:blue', marker='o')\nplt.plot(t2, f(t2), color='black')\nplt.title(\"Subplot 1\")\n\nplt.subplot(212)\nplt.plot(t2, np.cos(2*np.pi*t2), color='tab:orange', linestyle='--')\nplt.title(\"Subplot 2\")\nplt.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        ".. admonition:: References\n\n   The use of the following functions, methods, classes and modules is shown\n   in this example:\n\n   - `matplotlib.pyplot.figure`\n   - `matplotlib.pyplot.subplot`\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
}