{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9252d5a5-8af1-4f99-b799-ee044329fb23",
   "metadata": {
    "tags": [
     "hide"
    ]
   },
   "outputs": [],
   "source": [
    "import seaborn.objects as so"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "406f8f8d-b590-46f4-a230-626e32e52c71",
   "metadata": {},
   "source": [
    "Control the overall dimensions of the figure with `size`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fefc2b45-3510-4cd7-9de9-4806d71fc4c1",
   "metadata": {},
   "outputs": [],
   "source": [
    "p = so.Plot().layout(size=(4, 4))\n",
    "p"
   ]
  },
  {
   "cell_type": "raw",
   "id": "909a47bb-82f5-455a-99c3-7049d548561b",
   "metadata": {},
   "source": [
    "Subplots created by using :meth:`Plot.facet` or :meth:`Plot.pair` will shrink to fit in the available space:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3163687c-8d48-4e88-8dc2-35e16341e30e",
   "metadata": {},
   "outputs": [],
   "source": [
    "p.facet([\"A\", \"B\"], [\"X\", \"Y\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "feda7c3a-3862-48d4-bb18-419cd03fc081",
   "metadata": {},
   "source": [
    "You may find that different automatic layout engines give better or worse results with specific plots:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c2107939-c6a9-414c-b3a2-6f5d0dd60daf",
   "metadata": {},
   "outputs": [],
   "source": [
    "p.facet([\"A\", \"B\"], [\"X\", \"Y\"]).layout(engine=\"constrained\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d61054d1-dcef-4e11-9802-394bcc633f9f",
   "metadata": {},
   "source": [
    "With `extent`, you can control the size of the plot relative to the underlying figure. Because the notebook display adapts the figure background to the plot, this appears only to change the plot size in a notebook context. But it can be useful when saving or displaying through a `pyplot` GUI window:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1b5d5969-2925-474f-8e3c-99e4f90a7a2b",
   "metadata": {},
   "outputs": [],
   "source": [
    "p.layout(extent=[0, 0, .8, 1]).show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e5c41b7d-a064-4406-8571-a544b194f3dc",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py310",
   "language": "python",
   "name": "py310"
  },
  "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.10.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
