{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Equal axis aspect ratio\n\nHow to set and adjust plots with equal axis aspect ratios.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\n# Plot circle of radius 3.\n\nan = np.linspace(0, 2 * np.pi, 100)\nfig, axs = plt.subplots(2, 2)\n\naxs[0, 0].plot(3 * np.cos(an), 3 * np.sin(an))\naxs[0, 0].set_title('not equal, looks like ellipse', fontsize=10)\n\naxs[0, 1].plot(3 * np.cos(an), 3 * np.sin(an))\naxs[0, 1].axis('equal')\naxs[0, 1].set_title('equal, looks like circle', fontsize=10)\n\naxs[1, 0].plot(3 * np.cos(an), 3 * np.sin(an))\naxs[1, 0].axis('equal')\naxs[1, 0].set(xlim=(-3, 3), ylim=(-3, 3))\naxs[1, 0].set_title('still a circle, even after changing limits', fontsize=10)\n\naxs[1, 1].plot(3 * np.cos(an), 3 * np.sin(an))\naxs[1, 1].set_aspect('equal', 'box')\naxs[1, 1].set_title('still a circle, auto-adjusted data limits', fontsize=10)\n\nfig.tight_layout()\n\nplt.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        ".. tags::\n\n   component: axes\n   styling: size\n   plot-type: line\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
}