{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cdf469e7-0110-4b75-97d5-69c25aa290f5",
   "metadata": {},
   "source": [
    "# Single Class\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4a694f4d-ba0d-4ea4-b15e-db17a2fa8e61",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# If running in a notebook make matplotlib interactive\n",
    "%matplotlib ipympl"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8b0938f1-fab9-4127-b836-9c06a2fbc333",
   "metadata": {},
   "source": [
    "```{note}\n",
    "In a notebook you need to make sure to click on the figure in order to give it keyboard focus.\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "65afcfa0-1511-4721-a79a-8df969a1002f",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "from mpl_image_labeller import image_labeller\n",
    "\n",
    "images = np.random.randn(5, 10, 10)\n",
    "labeller = image_labeller(\n",
    "    images, classes=[\"good\", \"bad\", \"meh\"], label_keymap=[\"a\", \"s\", \"d\"]\n",
    ")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f517f339-a7e1-4bd5-bff4-fc56d9948a1d",
   "metadata": {},
   "source": [
    "After you label the images then the labels will be available as a list:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c79afd96-4f6d-46f8-ab7d-46b5dc6de38e",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "print(labeller.labels)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7416b621-d9be-4e5d-9600-14f341ee419b",
   "metadata": {},
   "source": [
    "Or as a onehot encoding"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cca10064-0f61-47c3-b526-5d1330170c61",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(labeller.labels_onehot)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "253335a9-17ea-4dfd-96a4-580f8593ac1d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
