{
 "cells": [
  {
   "cell_type": "raw",
   "id": "034a9a5b-91ff-4ccc-932d-0f314e2cd6d2",
   "metadata": {},
   "source": [
    "See the :func:`regplot` docs for demonstrations of various options for specifying the regression model, which are also accepted here."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "76c91243-3bd8-49a1-b8c8-b7272f09a3f1",
   "metadata": {
    "tags": [
     "hide"
    ]
   },
   "outputs": [],
   "source": [
    "import seaborn as sns\n",
    "sns.set_theme(style=\"ticks\")\n",
    "penguins = sns.load_dataset(\"penguins\")"
   ]
  },
  {
   "cell_type": "raw",
   "id": "0ba9f55d-17ea-4084-a74f-852d51771380",
   "metadata": {},
   "source": [
    "Plot a regression fit over a scatter plot:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2f789265-93c0-4867-b666-798713e4e7e5",
   "metadata": {},
   "outputs": [],
   "source": [
    "sns.lmplot(data=penguins, x=\"bill_length_mm\", y=\"bill_depth_mm\")"
   ]
  },
  {
   "cell_type": "raw",
   "id": "7e4b0ad4-446c-4109-9393-961f76132e34",
   "metadata": {},
   "source": [
    "Condition the regression fit on another variable and represent it using color:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "61347189-34e5-42ea-b77b-4acdef843326",
   "metadata": {},
   "outputs": [],
   "source": [
    "sns.lmplot(data=penguins, x=\"bill_length_mm\", y=\"bill_depth_mm\", hue=\"species\")"
   ]
  },
  {
   "cell_type": "raw",
   "id": "c9b6d059-49dc-46a7-869b-86baa3a7ed65",
   "metadata": {},
   "source": [
    "Condition the regression fit on another variable and split across subplots:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d8ec2955-ccc9-493c-b9ec-c78648ce9f53",
   "metadata": {},
   "outputs": [],
   "source": [
    "sns.lmplot(\n",
    "    data=penguins, x=\"bill_length_mm\", y=\"bill_depth_mm\",\n",
    "    hue=\"species\", col=\"sex\", height=4,\n",
    ")"
   ]
  },
  {
   "cell_type": "raw",
   "id": "de01dee1-b2ce-445c-8d0d-d054ca0dfedb",
   "metadata": {},
   "source": [
    "Condition across two variables using both columns and rows:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6f1264aa-829c-416a-805a-b989e5f11a17",
   "metadata": {},
   "outputs": [],
   "source": [
    "sns.lmplot(\n",
    "    data=penguins, x=\"bill_length_mm\", y=\"bill_depth_mm\",\n",
    "    col=\"species\", row=\"sex\", height=3,\n",
    ")"
   ]
  },
  {
   "cell_type": "raw",
   "id": "b3888f04-b22f-4205-8acc-24ce5b59568e",
   "metadata": {},
   "source": [
    "Allow axis limits to vary across subplots:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "67ed5af1-d228-4b81-b4f8-21937c513a10",
   "metadata": {},
   "outputs": [],
   "source": [
    "sns.lmplot(\n",
    "    data=penguins, x=\"bill_length_mm\", y=\"bill_depth_mm\",\n",
    "    col=\"species\", row=\"sex\", height=3,\n",
    "    facet_kws=dict(sharex=False, sharey=False),\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "46e9cf18-c847-4c40-8e38-6c20cdde2be5",
   "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
}
