{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "89113d6b-70b9-4ebe-9910-10a80eab246e",
   "metadata": {
    "tags": [
     "hide"
    ]
   },
   "outputs": [],
   "source": [
    "import seaborn.objects as so\n",
    "from seaborn import load_dataset\n",
    "tips = load_dataset(\"tips\")"
   ]
  },
  {
   "cell_type": "raw",
   "id": "daf6ff78-df24-4541-ba72-73fb9eddb50d",
   "metadata": {},
   "source": [
    "The transform counts distinct observations of the orientation variable defines a new variable on the opposite axis:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "390f2fd3-0596-40e3-b262-163b3a90d055",
   "metadata": {},
   "outputs": [],
   "source": [
    "so.Plot(tips, x=\"day\").add(so.Bar(), so.Count())"
   ]
  },
  {
   "cell_type": "raw",
   "id": "813fb4a5-db68-4b51-b236-5b5628ebba47",
   "metadata": {},
   "source": [
    "When additional mapping variables are defined, they are also used to define groups:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "76a4ae70-e914-4f54-b979-ce1b79374fc3",
   "metadata": {},
   "outputs": [],
   "source": [
    "so.Plot(tips, x=\"day\", color=\"sex\").add(so.Bar(), so.Count(), so.Dodge())"
   ]
  },
  {
   "cell_type": "raw",
   "id": "2973dee1-5aee-4768-846d-22d220faf170",
   "metadata": {},
   "source": [
    "Unlike :class:`Hist`, numeric data are not binned before counting:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6f94c5f0-680e-4d8a-a1c9-70876980dd1c",
   "metadata": {},
   "outputs": [],
   "source": [
    "so.Plot(tips, x=\"size\").add(so.Bar(), so.Count())"
   ]
  },
  {
   "cell_type": "raw",
   "id": "11acd5e6-f477-4eb1-b1d7-72f4582bca45",
   "metadata": {},
   "source": [
    "When the `y` variable is defined, the counts are assigned to the `x` variable:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "924e0e35-210f-4f65-83b4-4aebe41ad264",
   "metadata": {},
   "outputs": [],
   "source": [
    "so.Plot(tips, y=\"size\").add(so.Bar(), so.Count())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0229fa39-b6dc-48da-9a25-31e25ed34ebc",
   "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
}
