{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d1f05540",
   "metadata": {},
   "source": [
    "# geomPie()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "34f2ff62",
   "metadata": {},
   "source": [
    "A pie chart is a circular statistical graphic, which is divided into slices to illustrate numerical proportion."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "36044c48",
   "metadata": {},
   "source": [
    "1. [Default presentation](#1.-Default-presentation)\n",
    "\n",
    "    1.1. [Basic pie chart](#1.1.-Basic-pie-chart)\n",
    "    \n",
    "    1.2. [Improve appearance](#1.2.-Improve-appearance)   \n",
    "    \n",
    "    1.3. [Adding labels to pie sectors](#1.3.-Adding-labels-to-pie-sectors) \n",
    "    \n",
    "    1.4. [Use \"count2d\" statistical transformation](#1.4.-Use-\"count2d\"-statistical-transformation)\n",
    "      \n",
    "        \n",
    "2. [Pie size depending on data](#2.-Pie-size-depending-on-data)\n",
    "\n",
    "      \n",
    "3. [Explode](#3.-Explode)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "faa30d88",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:44.423420Z",
     "iopub.status.busy": "2025-12-03T16:01:44.422046Z",
     "iopub.status.idle": "2025-12-03T16:01:46.987117Z",
     "shell.execute_reply": "2025-12-03T16:01:46.986581Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "            <div id=\"kotlin_out_0\"></div>\n",
       "            <script type=\"text/javascript\">\n",
       "                            if(!window.kotlinQueues) {\n",
       "                window.kotlinQueues = {};\n",
       "            }\n",
       "            if(!window.kotlinQueues[\"DataFrame\"]) {\n",
       "                var resQueue = [];\n",
       "                window.kotlinQueues[\"DataFrame\"] = resQueue;\n",
       "                window[\"call_DataFrame\"] = function(f) {\n",
       "                    resQueue.push(f);\n",
       "                }\n",
       "            }\n",
       "            (function (){\n",
       "                var modifiers = [(function(script) {\n",
       "    script.src = \"https://cdn.jsdelivr.net/gh/Kotlin/dataframe@3db46ccccaa1291c0627307d64133317f545e6ae/core/src/main/resources/init.js\"\n",
       "    script.type = \"text/javascript\";\n",
       "})];\n",
       "                var e = document.getElementById(\"kotlin_out_0\");\n",
       "                modifiers.forEach(function (gen) {\n",
       "                    var script = document.createElement(\"script\");\n",
       "                    gen(script)\n",
       "                    script.addEventListener(\"load\", function() {\n",
       "                        window[\"call_DataFrame\"] = function(f) {f();};\n",
       "                        window.kotlinQueues[\"DataFrame\"].forEach(function(f) {f();});\n",
       "                        window.kotlinQueues[\"DataFrame\"] = [];\n",
       "                    }, false);\n",
       "                    script.addEventListener(\"error\", function() {\n",
       "                        window[\"call_DataFrame\"] = function(f) {};\n",
       "                        window.kotlinQueues[\"DataFrame\"] = [];\n",
       "                        var div = document.createElement(\"div\");\n",
       "                        div.style.color = 'darkred';\n",
       "                        div.textContent = 'Error loading resource DataFrame';\n",
       "                        document.getElementById(\"kotlin_out_0\").appendChild(div);\n",
       "                    }, false);\n",
       "                    \n",
       "                    e.appendChild(script);\n",
       "                });\n",
       "            })();\n",
       "            </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "                <style>\n",
       "                :root {\n",
       "    --background: #fff;\n",
       "    --background-odd: #f5f5f5;\n",
       "    --background-hover: #d9edfd;\n",
       "    --header-text-color: #474747;\n",
       "    --text-color: #848484;\n",
       "    --text-color-dark: #000;\n",
       "    --text-color-medium: #737373;\n",
       "    --text-color-pale: #b3b3b3;\n",
       "    --inner-border-color: #aaa;\n",
       "    --bold-border-color: #000;\n",
       "    --link-color: #296eaa;\n",
       "    --link-color-pale: #296eaa;\n",
       "    --link-hover: #1a466c;\n",
       "}\n",
       "\n",
       ":root[theme=\"dark\"], :root [data-jp-theme-light=\"false\"], .dataframe_dark{\n",
       "    --background: #303030;\n",
       "    --background-odd: #3c3c3c;\n",
       "    --background-hover: #464646;\n",
       "    --header-text-color: #dddddd;\n",
       "    --text-color: #b3b3b3;\n",
       "    --text-color-dark: #dddddd;\n",
       "    --text-color-medium: #b2b2b2;\n",
       "    --text-color-pale: #737373;\n",
       "    --inner-border-color: #707070;\n",
       "    --bold-border-color: #777777;\n",
       "    --link-color: #008dc0;\n",
       "    --link-color-pale: #97e1fb;\n",
       "    --link-hover: #00688e;\n",
       "}\n",
       "\n",
       "p.dataframe_description {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe {\n",
       "    font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n",
       "    font-size: 12px;\n",
       "    background-color: var(--background);\n",
       "    color: var(--text-color-dark);\n",
       "    border: none;\n",
       "    border-collapse: collapse;\n",
       "}\n",
       "\n",
       "table.dataframe th, td {\n",
       "    padding: 6px;\n",
       "    border: 1px solid transparent;\n",
       "    text-align: left;\n",
       "}\n",
       "\n",
       "table.dataframe th {\n",
       "    background-color: var(--background);\n",
       "    color: var(--header-text-color);\n",
       "}\n",
       "\n",
       "table.dataframe td {\n",
       "    vertical-align: top;\n",
       "    white-space: nowrap;\n",
       "}\n",
       "\n",
       "table.dataframe th.bottomBorder {\n",
       "    border-bottom-color: var(--bold-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(odd) {\n",
       "    background: var(--background-odd);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(even) {\n",
       "    background: var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:hover {\n",
       "    background: var(--background-hover);\n",
       "}\n",
       "\n",
       "table.dataframe a {\n",
       "    cursor: pointer;\n",
       "    color: var(--link-color);\n",
       "    text-decoration: none;\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover > td a {\n",
       "    color: var(--link-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe a:hover {\n",
       "    color: var(--link-hover);\n",
       "    text-decoration: underline;\n",
       "}\n",
       "\n",
       "table.dataframe img {\n",
       "    max-width: fit-content;\n",
       "}\n",
       "\n",
       "table.dataframe th.complex {\n",
       "    background-color: var(--background);\n",
       "    border: 1px solid var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe .leftBorder {\n",
       "    border-left-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightBorder {\n",
       "    border-right-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightAlign {\n",
       "    text-align: right;\n",
       "}\n",
       "\n",
       "table.dataframe .expanderSvg {\n",
       "    width: 8px;\n",
       "    height: 8px;\n",
       "    margin-right: 3px;\n",
       "}\n",
       "\n",
       "table.dataframe .expander {\n",
       "    display: flex;\n",
       "    align-items: center;\n",
       "}\n",
       "\n",
       "/* formatting */\n",
       "\n",
       "table.dataframe .null {\n",
       "    color: var(--text-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe .structural {\n",
       "    color: var(--text-color-medium);\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .dataFrameCaption {\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .numbers {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe td:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "\n",
       "                </style>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"vbrZsM\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
       "       if(!window.letsPlotCallQueue) {\n",
       "           window.letsPlotCallQueue = [];\n",
       "       }; \n",
       "       window.letsPlotCall = function(f) {\n",
       "           window.letsPlotCallQueue.push(f);\n",
       "       };\n",
       "       (function() {\n",
       "           var script = document.createElement(\"script\");\n",
       "           script.type = \"text/javascript\";\n",
       "           script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.8.1/js-package/distr/lets-plot.min.js\";\n",
       "           script.onload = function() {\n",
       "               window.letsPlotCall = function(f) {f();};\n",
       "               window.letsPlotCallQueue.forEach(function(f) {f();});\n",
       "               window.letsPlotCallQueue = [];\n",
       "               \n",
       "               \n",
       "           };\n",
       "           script.onerror = function(event) {\n",
       "               window.letsPlotCall = function(f) {};\n",
       "               window.letsPlotCallQueue = [];\n",
       "               var div = document.createElement(\"div\");\n",
       "               div.style.color = 'darkred';\n",
       "               div.textContent = 'Error loading Lets-Plot JS';\n",
       "               document.getElementById(\"vbrZsM\").appendChild(div);\n",
       "           };\n",
       "           var e = document.getElementById(\"vbrZsM\");\n",
       "           e.appendChild(script);\n",
       "       })();\n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "            <div id=\"kotlin_out_1\"></div>\n",
       "            <script type=\"text/javascript\">\n",
       "                            if(!window.kotlinQueues) {\n",
       "                window.kotlinQueues = {};\n",
       "            }\n",
       "            if(!window.kotlinQueues[\"letsPlotJs\"]) {\n",
       "                var resQueue = [];\n",
       "                window.kotlinQueues[\"letsPlotJs\"] = resQueue;\n",
       "                window[\"call_letsPlotJs\"] = function(f) {\n",
       "                    resQueue.push(f);\n",
       "                }\n",
       "            }\n",
       "            (function (){\n",
       "                var modifiers = [(function(script) {\n",
       "    script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.8.1/js-package/distr/lets-plot.min.js\"\n",
       "    script.type = \"text/javascript\";\n",
       "})];\n",
       "                var e = document.getElementById(\"kotlin_out_1\");\n",
       "                modifiers.forEach(function (gen) {\n",
       "                    var script = document.createElement(\"script\");\n",
       "                    gen(script)\n",
       "                    script.addEventListener(\"load\", function() {\n",
       "                        window[\"call_letsPlotJs\"] = function(f) {f();};\n",
       "                        window.kotlinQueues[\"letsPlotJs\"].forEach(function(f) {f();});\n",
       "                        window.kotlinQueues[\"letsPlotJs\"] = [];\n",
       "                    }, false);\n",
       "                    script.addEventListener(\"error\", function() {\n",
       "                        window[\"call_letsPlotJs\"] = function(f) {};\n",
       "                        window.kotlinQueues[\"letsPlotJs\"] = [];\n",
       "                        var div = document.createElement(\"div\");\n",
       "                        div.style.color = 'darkred';\n",
       "                        div.textContent = 'Error loading resource letsPlotJs';\n",
       "                        document.getElementById(\"kotlin_out_1\").appendChild(div);\n",
       "                    }, false);\n",
       "                    \n",
       "                    e.appendChild(script);\n",
       "                });\n",
       "            })();\n",
       "            </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%useLatestDescriptors\n",
    "%use dataframe\n",
    "%use lets-plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8786a3e7",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:46.988623Z",
     "iopub.status.busy": "2025-12-03T16:01:46.988373Z",
     "iopub.status.idle": "2025-12-03T16:01:47.018804Z",
     "shell.execute_reply": "2025-12-03T16:01:47.018881Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Lets-Plot Kotlin API v.4.12.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.8.1.\n",
       "Outputs: Web (HTML+JS), Kotlin Notebook (Swing), Static SVG (hidden)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "LetsPlot.getInfo()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "444122dd",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.021425Z",
     "iopub.status.busy": "2025-12-03T16:01:47.020737Z",
     "iopub.status.idle": "2025-12-03T16:01:47.084907Z",
     "shell.execute_reply": "2025-12-03T16:01:47.084466Z"
    }
   },
   "outputs": [],
   "source": [
    "val blankTheme = theme(line=elementBlank(), axis=elementBlank())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "42063da2",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.087436Z",
     "iopub.status.busy": "2025-12-03T16:01:47.086864Z",
     "iopub.status.idle": "2025-12-03T16:01:47.213629Z",
     "shell.execute_reply": "2025-12-03T16:01:47.213343Z"
    }
   },
   "outputs": [],
   "source": [
    "val (w, h) = 400 to 250\n",
    "\n",
    "val data = mapOf(\n",
    "    \"name\" to listOf('a', 'b', 'c', 'd', 'b'),\n",
    "    \"value\" to listOf(40, 90, 10,  50,  20)\n",
    ")\n",
    "\n",
    "val p = letsPlot(data) + ggsize(w,h)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d3496545",
   "metadata": {},
   "source": [
    "## 1. Default presentation"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e670679c",
   "metadata": {},
   "source": [
    "### 1.1. Basic pie chart"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ae3a2237",
   "metadata": {},
   "source": [
    "Use \"identity\" statistical transformation to leave the data unchanged."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "8e854954",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.215343Z",
     "iopub.status.busy": "2025-12-03T16:01:47.215093Z",
     "iopub.status.idle": "2025-12-03T16:01:47.505070Z",
     "shell.execute_reply": "2025-12-03T16:01:47.504889Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"VUumvl\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
       "       if(!window.letsPlotCallQueue) {\n",
       "           window.letsPlotCallQueue = [];\n",
       "       }; \n",
       "       window.letsPlotCall = function(f) {\n",
       "           window.letsPlotCallQueue.push(f);\n",
       "       };\n",
       "       (function() {\n",
       "           var script = document.createElement(\"script\");\n",
       "           script.type = \"text/javascript\";\n",
       "           script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.8.1/js-package/distr/lets-plot.min.js\";\n",
       "           script.onload = function() {\n",
       "               window.letsPlotCall = function(f) {f();};\n",
       "               window.letsPlotCallQueue.forEach(function(f) {f();});\n",
       "               window.letsPlotCallQueue = [];\n",
       "               \n",
       "               \n",
       "           };\n",
       "           script.onerror = function(event) {\n",
       "               window.letsPlotCall = function(f) {};\n",
       "               window.letsPlotCallQueue = [];\n",
       "               var div = document.createElement(\"div\");\n",
       "               div.style.color = 'darkred';\n",
       "               div.textContent = 'Error loading Lets-Plot JS';\n",
       "               document.getElementById(\"VUumvl\").appendChild(div);\n",
       "           };\n",
       "           var e = document.getElementById(\"VUumvl\");\n",
       "           e.appendChild(script);\n",
       "       })();\n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "data": {
         "name": [
          "a",
          "b",
          "c",
          "d",
          "b"
         ],
         "value": [
          40.0,
          90.0,
          10.0,
          50.0,
          20.0
         ]
        },
        "data_meta": {
         "series_annotations": [
          {
           "column": "value",
           "type": "int"
          }
         ]
        },
        "ggsize": {
         "height": 250.0,
         "width": 400.0
        },
        "kind": "plot",
        "layers": [
         {
          "geom": "pie",
          "mapping": {
           "fill": "name",
           "slice": "value"
          },
          "position": "identity",
          "stat": "identity"
         }
        ],
        "mapping": {},
        "scales": []
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"7PTkuf\" ></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"7PTkuf\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"name\":[\"a\",\"b\",\"c\",\"d\",\"b\"],\n",
       "\"value\":[40.0,90.0,10.0,50.0,20.0]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":400.0,\n",
       "\"height\":250.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"slice\":\"value\",\n",
       "\"fill\":\"name\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"value\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"1\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=db1b6b85-365b-46d6-9206-31482b275cf2 width=\"100%\" height=\"100%\" style=\"max-width: 400.0px; max-height: 250.0px;\" viewBox=\"0 0 400.0 250.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#pPbLsI7 .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dXpm9pX .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dXpm9pX .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pPbLsI7 .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dXpm9pX .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dXpm9pX .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dXpm9pX .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"pPbLsI7\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(21.0 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"29.124550581235383\" y1=\"0.0\" x2=\"29.124550581235383\" y2=\"204.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"87.37365174370616\" y1=\"0.0\" x2=\"87.37365174370616\" y2=\"204.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"145.62275290617694\" y1=\"0.0\" x2=\"145.62275290617694\" y2=\"204.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"203.87185406864774\" y1=\"0.0\" x2=\"203.87185406864774\" y2=\"204.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"262.1209552311185\" y1=\"0.0\" x2=\"262.1209552311185\" y2=\"204.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"0.0\" y1=\"183.60000000000002\" x2=\"291.2455058123539\" y2=\"183.60000000000002\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"142.8\" x2=\"291.2455058123539\" y2=\"142.8\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"102.0\" x2=\"291.2455058123539\" y2=\"102.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"61.199999999999996\" x2=\"291.2455058123539\" y2=\"61.199999999999996\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"20.39999999999999\" x2=\"291.2455058123539\" y2=\"20.39999999999999\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#cbxSWnf)\" clip-bounds-jfx=\"[rect (31.015306675749617, 0.0), (291.2455058123539, 204.0)]\">\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 102.0 L99.07906547396674 83.73294878168024 A50.0 50.0 0.0 0 1 145.62275290617694 52.0 L145.62275290617694 102.0 A0.0 0.0 0.0 0 0 145.62275290617694 102.0 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 102.0 L145.62275290617694 52.0 A50.0 50.0 0.0 0 1 167.31693986205485 147.04844339512096 L145.62275290617694 102.0 A0.0 0.0 0.0 0 0 145.62275290617694 102.0 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 102.0 L167.31693986205485 147.04844339512096 A50.0 50.0 0.0 0 1 153.07486621498566 151.44154131125643 L145.62275290617694 102.0 A0.0 0.0 0.0 0 0 145.62275290617694 102.0 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 102.0 L153.07486621498566 151.44154131125643 A50.0 50.0 0.0 0 1 96.87635729708576 113.12604669781572 L145.62275290617694 102.0 A0.0 0.0 0.0 0 0 145.62275290617694 102.0 \" fill=\"rgb(152,78,163)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 102.0 L96.87635729708576 113.12604669781572 A50.0 50.0 0.0 0 1 99.07906547396672 83.73294878168028 L145.62275290617694 102.0 A0.0 0.0 0.0 0 0 145.62275290617694 102.0 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M99.07906547396674 83.73294878168024 A50.0 50.0 0.0 0 1 145.62275290617694 52.0 M145.62275290617694 102.0 A0.0 0.0 0.0 0 0 145.62275290617694 102.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 52.0 A50.0 50.0 0.0 0 1 167.31693986205485 147.04844339512096 M145.62275290617694 102.0 A0.0 0.0 0.0 0 0 145.62275290617694 102.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M167.31693986205485 147.04844339512096 A50.0 50.0 0.0 0 1 153.07486621498566 151.44154131125643 M145.62275290617694 102.0 A0.0 0.0 0.0 0 0 145.62275290617694 102.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M153.07486621498566 151.44154131125643 A50.0 50.0 0.0 0 1 96.87635729708576 113.12604669781572 M145.62275290617694 102.0 A0.0 0.0 0.0 0 0 145.62275290617694 102.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M96.87635729708576 113.12604669781572 A50.0 50.0 0.0 0 1 99.07906547396672 83.73294878168028 M145.62275290617694 102.0 A0.0 0.0 0.0 0 0 145.62275290617694 102.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 102.0 L98.72998781822517 83.59594589754283 M145.62275290617694 102.0 L145.62275290617694 51.625 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 102.0 L145.62275290617694 51.625 M145.62275290617694 102.0 L167.47964626422393 147.38630672058437 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 102.0 L167.47964626422393 147.38630672058437 M145.62275290617694 102.0 L153.13075706480174 151.81235287109087 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 102.0 L153.13075706480174 151.81235287109087 M145.62275290617694 102.0 L96.51075933001758 113.20949204804934 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.62275290617694 102.0 L96.51075933001758 113.20949204804934 M145.62275290617694 102.0 L98.72998781822514 83.59594589754288 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cbxSWnf\">\n",
       "            <rect x=\"31.015306675749617\" y=\"0.0\" width=\"291.2455058123539\" height=\"204.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 204.0 ) \">\n",
       "          <g transform=\"translate(29.124550581235383 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 6.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
       "                <tspan>-0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(87.37365174370616 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 6.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
       "                <tspan>-0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(145.62275290617694 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 6.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
       "                <tspan>0</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(203.87185406864774 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 6.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
       "                <tspan>0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(262.1209552311185 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 6.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
       "                <tspan>0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <line x1=\"0.0\" y1=\"0.0\" x2=\"291.2455058123539\" y2=\"0.0\" stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\">\n",
       "          </line>\n",
       "        </g>\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g transform=\"translate(0.0 183.60000000000002 ) \">\n",
       "            <g transform=\"translate(-2.0 0.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
       "                <tspan>-0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 142.8 ) \">\n",
       "            <g transform=\"translate(-2.0 0.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
       "                <tspan>-0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 102.0 ) \">\n",
       "            <g transform=\"translate(-2.0 0.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
       "                <tspan>0</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 61.199999999999996 ) \">\n",
       "            <g transform=\"translate(-2.0 0.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
       "                <tspan>0.2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 20.39999999999999 ) \">\n",
       "            <g transform=\"translate(-2.0 0.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
       "                <tspan>0.4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(15.0 108.0 ) rotate(-90.0 ) \">\n",
       "      <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"axis-title-y\" text-anchor=\"middle\">\n",
       "        <tspan>y</tspan>\n",
       "      </text>\n",
       "    </g>\n",
       "    <g transform=\"translate(197.63805958192654 244.0 ) \">\n",
       "      <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"axis-title-x\" text-anchor=\"middle\">\n",
       "        <tspan>x</tspan>\n",
       "      </text>\n",
       "    </g>\n",
       "    <g transform=\"translate(346.2608124881035 45.75 ) \">\n",
       "      <rect x=\"0.0\" y=\"0.0\" height=\"124.5\" width=\"50.739187511896475\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\">\n",
       "      </rect>\n",
       "      <g transform=\"translate(5.0 5.0 ) \">\n",
       "        <g transform=\"translate(0.0 12.0 ) \">\n",
       "          <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"legend-title\">\n",
       "            <tspan>name</tspan>\n",
       "          </text>\n",
       "        </g>\n",
       "        <g transform=\"translate(0.0 22.5 ) \">\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(228,26,28)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>a</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 23.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(55,126,184)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>b</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 46.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(77,175,74)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>c</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 69.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(152,78,163)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>d</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dXpm9pX\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"db1b6b85-365b-46d6-9206-31482b275cf2\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p + geomPie(stat = Stat.identity) { slice = \"value\"; fill = \"name\" }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a6468831",
   "metadata": {},
   "source": [
    "### 1.2. Improve appearance"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9b23c4df",
   "metadata": {},
   "source": [
    "- add stroke (`stroke` and `color`)\n",
    "- make the pie bigger (`size`)\n",
    "- add hole to draw donut-like chart (`hole`)\n",
    "- use blank theme (remove axis and grid)\n",
    "- use better colors"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "f9fbaa2c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.506310Z",
     "iopub.status.busy": "2025-12-03T16:01:47.506081Z",
     "iopub.status.idle": "2025-12-03T16:01:47.557405Z",
     "shell.execute_reply": "2025-12-03T16:01:47.557501Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "data": {
         "name": [
          "a",
          "b",
          "c",
          "d",
          "b"
         ],
         "value": [
          40.0,
          90.0,
          10.0,
          50.0,
          20.0
         ]
        },
        "data_meta": {
         "series_annotations": [
          {
           "column": "value",
           "type": "int"
          }
         ]
        },
        "ggsize": {
         "height": 250.0,
         "width": 400.0
        },
        "kind": "plot",
        "layers": [
         {
          "color": "white",
          "geom": "pie",
          "hole": 0.5,
          "mapping": {
           "fill": "name",
           "slice": "value"
          },
          "position": "identity",
          "size": 20.0,
          "stat": "identity",
          "stroke": 1.0
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "fill",
          "palette": "Set1",
          "scale_mapper_kind": "color_brewer"
         }
        ],
        "theme": {
         "axis": {
          "blank": true
         },
         "line": {
          "blank": true
         }
        }
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"nT901f\" ></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"nT901f\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"name\":[\"a\",\"b\",\"c\",\"d\",\"b\"],\n",
       "\"value\":[40.0,90.0,10.0,50.0,20.0]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":400.0,\n",
       "\"height\":250.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"palette\":\"Set1\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"hole\":0.5,\n",
       "\"mapping\":{\n",
       "\"slice\":\"value\",\n",
       "\"fill\":\"name\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":20.0,\n",
       "\"color\":\"white\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"stroke\":1.0,\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "}\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"value\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"3\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=3ea87bc4-e7b6-44cf-9dfb-c5e43097e59b width=\"100%\" height=\"100%\" style=\"max-width: 400.0px; max-height: 250.0px;\" viewBox=\"0 0 400.0 250.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#pVYyXgy .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#pVYyXgy .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pVYyXgy .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pVYyXgy .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#pVYyXgy .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pVYyXgy .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pVYyXgy .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pVYyXgy .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#djxFoML .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pVYyXgy .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pVYyXgy .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#djxFoML .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pVYyXgy .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pVYyXgy .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#djxFoML .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#djxFoML .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#djxFoML .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"pVYyXgy\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(6.0 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#c9sFiFb)\" clip-bounds-jfx=\"[rect (0.0, 0.0), (337.2608124881035, 238.0)]\">\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <path d=\"M122.08671881184155 100.73294878168024 L75.54303137963134 82.46589756336047 A100.0 100.0 0.0 0 1 168.63040624405176 19.0 L168.63040624405176 69.0 A50.0 50.0 0.0 0 0 122.08671881184155 100.73294878168024 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M168.63040624405176 69.0 L168.63040624405176 19.0 A100.0 100.0 0.0 0 1 212.01878015580758 209.0968867902419 L190.32459319992967 164.04844339512096 A50.0 50.0 0.0 0 0 168.63040624405176 69.0 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M190.32459319992967 164.04844339512096 L212.01878015580758 209.0968867902419 A100.0 100.0 0.0 0 1 183.53463286166922 217.88308262251286 L176.08251955286048 168.44154131125643 A50.0 50.0 0.0 0 0 190.32459319992967 164.04844339512096 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M176.08251955286048 168.44154131125643 L183.53463286166922 217.88308262251286 A100.0 100.0 0.0 0 1 71.1376150258694 141.25209339563145 L119.88401063496057 130.12604669781572 A50.0 50.0 0.0 0 0 176.08251955286048 168.44154131125643 \" fill=\"rgb(152,78,163)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M119.88401063496057 130.12604669781572 L71.1376150258694 141.25209339563145 A100.0 100.0 0.0 0 1 75.54303137963132 82.46589756336054 L122.08671881184154 100.73294878168028 A50.0 50.0 0.0 0 0 119.88401063496057 130.12604669781572 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M75.54303137963134 82.46589756336047 A100.0 100.0 0.0 0 1 168.63040624405176 19.0 M168.63040624405176 69.0 A50.0 50.0 0.0 0 0 122.08671881184155 100.73294878168024 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M168.63040624405176 19.0 A100.0 100.0 0.0 0 1 212.01878015580758 209.0968867902419 M190.32459319992967 164.04844339512096 A50.0 50.0 0.0 0 0 168.63040624405176 69.0 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M212.01878015580758 209.0968867902419 A100.0 100.0 0.0 0 1 183.53463286166922 217.88308262251286 M176.08251955286048 168.44154131125643 A50.0 50.0 0.0 0 0 190.32459319992967 164.04844339512096 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M183.53463286166922 217.88308262251286 A100.0 100.0 0.0 0 1 71.1376150258694 141.25209339563145 M119.88401063496057 130.12604669781572 A50.0 50.0 0.0 0 0 176.08251955286048 168.44154131125643 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M71.1376150258694 141.25209339563145 A100.0 100.0 0.0 0 1 75.54303137963132 82.46589756336054 M122.08671881184154 100.73294878168028 A50.0 50.0 0.0 0 0 119.88401063496057 130.12604669781572 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M122.55215568616364 100.91561929386344 L75.07759450530924 82.28322705117728 M168.63040624405176 69.5 L168.63040624405176 18.5 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M168.63040624405176 69.5 L168.63040624405176 18.5 M190.10765133037089 163.59795896116975 L212.23572202536636 209.5473712241931 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M190.10765133037089 163.59795896116975 L212.23572202536636 209.5473712241931 M176.0079984197724 167.94712589814387 L183.60915399475732 218.37749803562542 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M176.0079984197724 167.94712589814387 L183.60915399475732 218.37749803562542 M120.37147459105148 130.01478623083756 L70.65015106977849 141.3633538626096 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M120.37147459105148 130.01478623083756 L70.65015106977849 141.3633538626096 M122.55215568616364 100.91561929386347 L75.07759450530921 82.28322705117733 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"c9sFiFb\">\n",
       "            <rect x=\"0.0\" y=\"0.0\" width=\"337.2608124881035\" height=\"238.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(0.0 238.0 ) \">\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(346.2608124881035 62.75 ) \">\n",
       "      <rect x=\"0.0\" y=\"0.0\" height=\"124.5\" width=\"50.739187511896475\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\">\n",
       "      </rect>\n",
       "      <g transform=\"translate(5.0 5.0 ) \">\n",
       "        <g transform=\"translate(0.0 12.0 ) \">\n",
       "          <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"legend-title\">\n",
       "            <tspan>name</tspan>\n",
       "          </text>\n",
       "        </g>\n",
       "        <g transform=\"translate(0.0 22.5 ) \">\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(228,26,28)\" fill-opacity=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>a</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 23.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(55,126,184)\" fill-opacity=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>b</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 46.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(77,175,74)\" fill-opacity=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>c</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 69.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(152,78,163)\" fill-opacity=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>d</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"djxFoML\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"3ea87bc4-e7b6-44cf-9dfb-c5e43097e59b\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p +\n",
    "    geomPie(stat = Stat.identity,\n",
    "            size = 20, stroke = 1, color = \"white\", hole = 0.5) { slice = \"value\"; fill = \"name\" } +\n",
    "    blankTheme + \n",
    "    scaleFillBrewer(palette = \"Set1\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a760b099",
   "metadata": {},
   "source": [
    "### 1.3. Adding labels to pie sectors"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "46617ca9",
   "metadata": {},
   "source": [
    "Let's label the sectors with their names - configure annotations via `layerLabels()` function: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "1ffd0e96",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.558593Z",
     "iopub.status.busy": "2025-12-03T16:01:47.558454Z",
     "iopub.status.idle": "2025-12-03T16:01:47.629274Z",
     "shell.execute_reply": "2025-12-03T16:01:47.629395Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "data": {
         "name": [
          "a",
          "b",
          "c",
          "d",
          "b"
         ],
         "value": [
          40.0,
          90.0,
          10.0,
          50.0,
          20.0
         ]
        },
        "data_meta": {
         "series_annotations": [
          {
           "column": "value",
           "type": "int"
          }
         ]
        },
        "ggsize": {
         "height": 250.0,
         "width": 400.0
        },
        "kind": "plot",
        "layers": [
         {
          "color": "white",
          "geom": "pie",
          "hole": 0.5,
          "labels": {
           "annotation_size": 16,
           "lines": [
            "@name"
           ]
          },
          "mapping": {
           "fill": "name",
           "slice": "value"
          },
          "position": "identity",
          "size": 20.0,
          "stat": "identity",
          "stroke": 1.0
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "fill",
          "palette": "Set1",
          "scale_mapper_kind": "color_brewer"
         }
        ],
        "theme": {
         "axis": {
          "blank": true
         },
         "legend_position": "none",
         "line": {
          "blank": true
         }
        }
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"kegt6V\" ></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"kegt6V\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"name\":[\"a\",\"b\",\"c\",\"d\",\"b\"],\n",
       "\"value\":[40.0,90.0,10.0,50.0,20.0]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":400.0,\n",
       "\"height\":250.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"palette\":\"Set1\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"hole\":0.5,\n",
       "\"mapping\":{\n",
       "\"slice\":\"value\",\n",
       "\"fill\":\"name\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":20.0,\n",
       "\"color\":\"white\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"stroke\":1.0,\n",
       "\"labels\":{\n",
       "\"lines\":[\"@name\"],\n",
       "\"annotation_size\":16\n",
       "},\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"legend_position\":\"none\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"value\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"5\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=c85a30b8-0540-40e2-a930-d89d4df7a05e width=\"100%\" height=\"100%\" style=\"max-width: 400.0px; max-height: 250.0px;\" viewBox=\"0 0 400.0 250.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#p4XR9cu .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#p4XR9cu .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p4XR9cu .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p4XR9cu .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#p4XR9cu .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p4XR9cu .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p4XR9cu .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p4XR9cu .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d5jSrlW .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p4XR9cu .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p4XR9cu .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d5jSrlW .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p4XR9cu .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p4XR9cu .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d5jSrlW .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d5jSrlW .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d5jSrlW .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"p4XR9cu\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(6.0 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#c1QDjuO)\" clip-bounds-jfx=\"[rect (0.0, 0.0), (388.0, 238.0)]\">\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <path d=\"M147.45631256778978 100.73294878168024 L100.91262513557959 82.46589756336047 A100.0 100.0 0.0 0 1 194.0 19.0 L194.0 69.0 A50.0 50.0 0.0 0 0 147.45631256778978 100.73294878168024 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M194.0 69.0 L194.0 19.0 A100.0 100.0 0.0 0 1 237.38837391175582 209.0968867902419 L215.6941869558779 164.04844339512096 A50.0 50.0 0.0 0 0 194.0 69.0 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M215.6941869558779 164.04844339512096 L237.38837391175582 209.0968867902419 A100.0 100.0 0.0 0 1 208.90422661761747 217.88308262251286 L201.45211330880872 168.44154131125643 A50.0 50.0 0.0 0 0 215.6941869558779 164.04844339512096 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M201.45211330880872 168.44154131125643 L208.90422661761747 217.88308262251286 A100.0 100.0 0.0 0 1 96.50720878181764 141.25209339563145 L145.25360439090883 130.12604669781572 A50.0 50.0 0.0 0 0 201.45211330880872 168.44154131125643 \" fill=\"rgb(152,78,163)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.25360439090883 130.12604669781572 L96.50720878181764 141.25209339563145 A100.0 100.0 0.0 0 1 100.91262513557956 82.46589756336054 L147.45631256778978 100.73294878168028 A50.0 50.0 0.0 0 0 145.25360439090883 130.12604669781572 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M100.91262513557959 82.46589756336047 A100.0 100.0 0.0 0 1 194.0 19.0 M194.0 69.0 A50.0 50.0 0.0 0 0 147.45631256778978 100.73294878168024 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M194.0 19.0 A100.0 100.0 0.0 0 1 237.38837391175582 209.0968867902419 M215.6941869558779 164.04844339512096 A50.0 50.0 0.0 0 0 194.0 69.0 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M237.38837391175582 209.0968867902419 A100.0 100.0 0.0 0 1 208.90422661761747 217.88308262251286 M201.45211330880872 168.44154131125643 A50.0 50.0 0.0 0 0 215.6941869558779 164.04844339512096 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M208.90422661761747 217.88308262251286 A100.0 100.0 0.0 0 1 96.50720878181764 141.25209339563145 M145.25360439090883 130.12604669781572 A50.0 50.0 0.0 0 0 201.45211330880872 168.44154131125643 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M96.50720878181764 141.25209339563145 A100.0 100.0 0.0 0 1 100.91262513557956 82.46589756336054 M147.45631256778978 100.73294878168028 A50.0 50.0 0.0 0 0 145.25360439090883 130.12604669781572 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M147.9217494421119 100.91561929386344 L100.44718826125748 82.28322705117728 M194.0 69.5 L194.0 18.5 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M194.0 69.5 L194.0 18.5 M215.47724508631913 163.59795896116975 L237.6053157813146 209.5473712241931 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M215.47724508631913 163.59795896116975 L237.6053157813146 209.5473712241931 M201.37759217572065 167.94712589814387 L208.97874775070557 218.37749803562542 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M201.37759217572065 167.94712589814387 L208.97874775070557 218.37749803562542 M145.74106834699973 130.01478623083756 L96.01974482572673 141.3633538626096 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M145.74106834699973 130.01478623083756 L96.01974482572673 141.3633538626096 M147.9217494421119 100.91561929386347 L100.44718826125745 82.28322705117733 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 151.7509956452284 57.03209192630037 ) \">\n",
       "                <g transform=\"translate(151.7509956452284 61.832091926300365 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>a</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 267.1195934136368 102.31092995327643 ) \">\n",
       "                <g transform=\"translate(267.1195934136368 107.11092995327643 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>b</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 216.10663808081782 190.66796043396056 ) \">\n",
       "                <g transform=\"translate(216.10663808081782 195.46796043396057 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>c</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 151.7509956452284 180.96790807369962 ) \">\n",
       "                <g transform=\"translate(151.7509956452284 185.76790807369963 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>d</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 119.20971521141149 113.3952429810182 ) \">\n",
       "                <g transform=\"translate(119.20971521141149 118.1952429810182 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>b</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"c1QDjuO\">\n",
       "            <rect x=\"0.0\" y=\"0.0\" width=\"388.0\" height=\"238.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(0.0 238.0 ) \">\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"d5jSrlW\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"c85a30b8-0540-40e2-a930-d89d4df7a05e\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p + \n",
    "    geomPie(\n",
    "        stat = Stat.identity,\n",
    "        size = 20, stroke = 1, color = \"white\", hole = 0.5,\n",
    "        labels = layerLabels().line(\"@name\").size(16)\n",
    "    ) { slice = \"value\"; fill = \"name\" } +\n",
    "    blankTheme + \n",
    "    theme().legendPositionNone() +\n",
    "    scaleFillBrewer(palette = \"Set1\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df65d3f1",
   "metadata": {},
   "source": [
    "### 1.4. Use \"count2d\" statistical transformation"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "73a8987c",
   "metadata": {},
   "source": [
    "`geomPie()` uses `count2d` stat by default. \n",
    "It allows to make a slice sizes proportional to the number of cases in each group  (or if the weight aesthetic is supplied, the sum of the weights). Also `count2d` provides variables for proportion ('..prop..') and proportion in percent ('..proppct..'). "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e9d823c8",
   "metadata": {},
   "source": [
    "Using `layerTooltips()` prepare the information for tooltips by adding the variables provided by 'count2d':"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "1d183b4d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.631272Z",
     "iopub.status.busy": "2025-12-03T16:01:47.630919Z",
     "iopub.status.idle": "2025-12-03T16:01:47.661490Z",
     "shell.execute_reply": "2025-12-03T16:01:47.661112Z"
    }
   },
   "outputs": [],
   "source": [
    "val tooltipContent = layerTooltips()\n",
    "                        .line(\"count|@{..count..} (@{..prop..})\")\n",
    "                        .line(\"total|@{..sum..}\")\n",
    "                        .format(\"..prop..\", \".0%\")\n",
    "                        .format(\"..count..\", \".1f\")\n",
    "                        .format(\"..sum..\", \".1f\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2bce5820",
   "metadata": {},
   "source": [
    "Apply 'count2d' to get slices proportional to the number of cases."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "ab7010dc",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.663194Z",
     "iopub.status.busy": "2025-12-03T16:01:47.662980Z",
     "iopub.status.idle": "2025-12-03T16:01:47.732444Z",
     "shell.execute_reply": "2025-12-03T16:01:47.732241Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "data": {
         "name": [
          "a",
          "b",
          "c",
          "d",
          "b"
         ],
         "value": [
          40.0,
          90.0,
          10.0,
          50.0,
          20.0
         ]
        },
        "data_meta": {
         "series_annotations": [
          {
           "column": "value",
           "type": "int"
          }
         ]
        },
        "ggsize": {
         "height": 250.0,
         "width": 400.0
        },
        "kind": "plot",
        "layers": [
         {
          "color": "white",
          "geom": "pie",
          "hole": 0.5,
          "labels": {
           "annotation_size": 16,
           "lines": [
            "@name"
           ]
          },
          "mapping": {
           "fill": "name"
          },
          "position": "identity",
          "size": 20.0,
          "stat": "count2d",
          "stroke": 1.0,
          "tooltips": {
           "formats": [
            {
             "field": "..prop..",
             "format": ".0%"
            },
            {
             "field": "..count..",
             "format": ".1f"
            },
            {
             "field": "..sum..",
             "format": ".1f"
            }
           ],
           "lines": [
            "count|@{..count..} (@{..prop..})",
            "total|@{..sum..}"
           ]
          }
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "fill",
          "palette": "Set1",
          "scale_mapper_kind": "color_brewer"
         }
        ],
        "theme": {
         "axis": {
          "blank": true
         },
         "legend_position": "none",
         "line": {
          "blank": true
         }
        }
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"eB9gR0\" ></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"eB9gR0\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":400.0,\n",
       "\"height\":250.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"palette\":\"Set1\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"hole\":0.5,\n",
       "\"mapping\":{\n",
       "\"fill\":\"name\"\n",
       "},\n",
       "\"stat\":\"count2d\",\n",
       "\"size\":20.0,\n",
       "\"color\":\"white\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"stroke\":1.0,\n",
       "\"tooltips\":{\n",
       "\"lines\":[\"count|@{..count..} (@{..prop..})\",\"total|@{..sum..}\"],\n",
       "\"formats\":[{\n",
       "\"field\":\"..prop..\",\n",
       "\"format\":\".0%\"\n",
       "},{\n",
       "\"field\":\"..count..\",\n",
       "\"format\":\".1f\"\n",
       "},{\n",
       "\"field\":\"..sum..\",\n",
       "\"format\":\".1f\"\n",
       "}]\n",
       "},\n",
       "\"labels\":{\n",
       "\"lines\":[\"@name\"],\n",
       "\"annotation_size\":16\n",
       "},\n",
       "\"data\":{\n",
       "\"..sum..\":[5.0,5.0,5.0,5.0],\n",
       "\"..count..\":[1.0,2.0,1.0,1.0],\n",
       "\"..x..\":[0.0,0.0,0.0,0.0],\n",
       "\"..y..\":[0.0,0.0,0.0,0.0],\n",
       "\"name\":[\"a\",\"b\",\"c\",\"d\"],\n",
       "\"..prop..\":[0.2,0.4,0.2,0.2]\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"legend_position\":\"none\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"value\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"7\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=b57921e4-a779-4f29-84cd-ef6ef933b0fc width=\"100%\" height=\"100%\" style=\"max-width: 400.0px; max-height: 250.0px;\" viewBox=\"0 0 400.0 250.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#p2W4UEd .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#p2W4UEd .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p2W4UEd .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p2W4UEd .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#p2W4UEd .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p2W4UEd .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p2W4UEd .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p2W4UEd .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dA3mEPw .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p2W4UEd .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p2W4UEd .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dA3mEPw .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p2W4UEd .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p2W4UEd .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dA3mEPw .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dA3mEPw .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dA3mEPw .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"p2W4UEd\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(6.0 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#cac1oJZ)\" clip-bounds-jfx=\"[rect (0.0, 0.0), (388.0, 238.0)]\">\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <path d=\"M146.44717418524232 103.54915028125262 L98.89434837048465 88.09830056250524 A100.0 100.0 0.0 0 1 194.0 19.0 L194.0 69.0 A50.0 50.0 0.0 0 0 146.44717418524232 103.54915028125262 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M194.0 69.0 L194.0 19.0 A100.0 100.0 0.0 0 1 252.77852522924732 199.90169943749476 L223.38926261462365 159.45084971874738 A50.0 50.0 0.0 0 0 194.0 69.0 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M223.38926261462365 159.45084971874738 L252.77852522924732 199.90169943749476 A100.0 100.0 0.0 0 1 135.2214747707527 199.90169943749476 L164.61073738537635 159.45084971874738 A50.0 50.0 0.0 0 0 223.38926261462365 159.45084971874738 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M164.61073738537635 159.45084971874738 L135.2214747707527 199.90169943749476 A100.0 100.0 0.0 0 1 98.89434837048464 88.09830056250527 L146.44717418524232 103.54915028125264 A50.0 50.0 0.0 0 0 164.61073738537635 159.45084971874738 \" fill=\"rgb(152,78,163)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M98.89434837048465 88.09830056250524 A100.0 100.0 0.0 0 1 194.0 19.0 M194.0 69.0 A50.0 50.0 0.0 0 0 146.44717418524232 103.54915028125262 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M194.0 19.0 A100.0 100.0 0.0 0 1 252.77852522924732 199.90169943749476 M223.38926261462365 159.45084971874738 A50.0 50.0 0.0 0 0 194.0 69.0 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M252.77852522924732 199.90169943749476 A100.0 100.0 0.0 0 1 135.2214747707527 199.90169943749476 M164.61073738537635 159.45084971874738 A50.0 50.0 0.0 0 0 223.38926261462365 159.45084971874738 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M135.2214747707527 199.90169943749476 A100.0 100.0 0.0 0 1 98.89434837048464 88.09830056250527 M146.44717418524232 103.54915028125264 A50.0 50.0 0.0 0 0 164.61073738537635 159.45084971874738 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M146.9227024433899 103.7036587784401 L98.41882011233707 87.94379206531778 M194.0 69.5 L194.0 18.5 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M194.0 69.5 L194.0 18.5 M223.09536998847742 159.04634122155989 L253.07241785539355 200.30620793468222 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M223.09536998847742 159.04634122155989 L253.07241785539355 200.30620793468222 M164.90463001152258 159.04634122155989 L134.92758214460645 200.30620793468222 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M164.90463001152258 159.04634122155989 L134.92758214460645 200.30620793468222 M146.92270244338988 103.70365877844011 L98.41882011233706 87.9437920653178 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 149.91610607806453 58.32372542187894 ) \">\n",
       "                <g transform=\"translate(149.91610607806453 63.123725421878945 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>a</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 265.3292387221365 95.82372542187895 ) \">\n",
       "                <g transform=\"translate(265.3292387221365 100.62372542187894 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>b</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 194.0 194.0 ) \">\n",
       "                <g transform=\"translate(194.0 198.8 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>c</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 122.67076127786349 142.17627457812105 ) \">\n",
       "                <g transform=\"translate(122.67076127786349 146.97627457812106 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>d</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cac1oJZ\">\n",
       "            <rect x=\"0.0\" y=\"0.0\" width=\"388.0\" height=\"238.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(0.0 238.0 ) \">\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dA3mEPw\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"b57921e4-a779-4f29-84cd-ef6ef933b0fc\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p +\n",
    "    geomPie(\n",
    "        size = 20, stroke = 1, color = \"white\", hole = 0.5,\n",
    "        labels = layerLabels().line(\"@name\").size(16),\n",
    "        tooltips = tooltipContent\n",
    "    ) { fill = \"name\" } +\n",
    "    blankTheme + \n",
    "    theme().legendPositionNone() +\n",
    "    scaleFillBrewer(palette = \"Set1\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "32d1cdc0",
   "metadata": {},
   "source": [
    "Compute weighted sum instead of simple count with aesthetic `weight`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "77f81cce",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.734284Z",
     "iopub.status.busy": "2025-12-03T16:01:47.733724Z",
     "iopub.status.idle": "2025-12-03T16:01:47.787673Z",
     "shell.execute_reply": "2025-12-03T16:01:47.787751Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "data": {
         "name": [
          "a",
          "b",
          "c",
          "d",
          "b"
         ],
         "value": [
          40.0,
          90.0,
          10.0,
          50.0,
          20.0
         ]
        },
        "data_meta": {
         "series_annotations": [
          {
           "column": "value",
           "type": "int"
          }
         ]
        },
        "ggsize": {
         "height": 250.0,
         "width": 400.0
        },
        "kind": "plot",
        "layers": [
         {
          "color": "white",
          "geom": "pie",
          "hole": 0.5,
          "labels": {
           "annotation_size": 16,
           "lines": [
            "@name"
           ]
          },
          "mapping": {
           "fill": "name",
           "weight": "value"
          },
          "position": "identity",
          "size": 20.0,
          "stat": "count2d",
          "stroke": 1.0,
          "tooltips": {
           "formats": [
            {
             "field": "..prop..",
             "format": ".0%"
            },
            {
             "field": "..count..",
             "format": ".1f"
            },
            {
             "field": "..sum..",
             "format": ".1f"
            }
           ],
           "lines": [
            "count|@{..count..} (@{..prop..})",
            "total|@{..sum..}"
           ]
          }
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "fill",
          "palette": "Set1",
          "scale_mapper_kind": "color_brewer"
         }
        ],
        "theme": {
         "axis": {
          "blank": true
         },
         "legend_position": "none",
         "line": {
          "blank": true
         }
        }
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"GkfdrV\" ></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"GkfdrV\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":400.0,\n",
       "\"height\":250.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"palette\":\"Set1\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"hole\":0.5,\n",
       "\"mapping\":{\n",
       "\"fill\":\"name\",\n",
       "\"weight\":\"value\"\n",
       "},\n",
       "\"stat\":\"count2d\",\n",
       "\"size\":20.0,\n",
       "\"color\":\"white\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"stroke\":1.0,\n",
       "\"tooltips\":{\n",
       "\"lines\":[\"count|@{..count..} (@{..prop..})\",\"total|@{..sum..}\"],\n",
       "\"formats\":[{\n",
       "\"field\":\"..prop..\",\n",
       "\"format\":\".0%\"\n",
       "},{\n",
       "\"field\":\"..count..\",\n",
       "\"format\":\".1f\"\n",
       "},{\n",
       "\"field\":\"..sum..\",\n",
       "\"format\":\".1f\"\n",
       "}]\n",
       "},\n",
       "\"labels\":{\n",
       "\"lines\":[\"@name\"],\n",
       "\"annotation_size\":16\n",
       "},\n",
       "\"data\":{\n",
       "\"..sum..\":[210.0,210.0,210.0,210.0],\n",
       "\"..count..\":[40.0,110.0,10.0,50.0],\n",
       "\"..x..\":[0.0,0.0,0.0,0.0],\n",
       "\"..y..\":[0.0,0.0,0.0,0.0],\n",
       "\"name\":[\"a\",\"b\",\"c\",\"d\"],\n",
       "\"..prop..\":[0.19047619047619047,0.5238095238095238,0.047619047619047616,0.23809523809523808]\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"legend_position\":\"none\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"value\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"9\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=8d328e47-7eb2-4346-b3df-a4ee90df58b6 width=\"100%\" height=\"100%\" style=\"max-width: 400.0px; max-height: 250.0px;\" viewBox=\"0 0 400.0 250.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#pBseza9 .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#pBseza9 .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pBseza9 .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pBseza9 .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#pBseza9 .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pBseza9 .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pBseza9 .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pBseza9 .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dVyaHNF .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pBseza9 .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pBseza9 .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dVyaHNF .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pBseza9 .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pBseza9 .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dVyaHNF .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dVyaHNF .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dVyaHNF .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"pBseza9\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(6.0 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#cJ3q3b2)\" clip-bounds-jfx=\"[rect (0.0, 0.0), (388.0, 238.0)]\">\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <path d=\"M147.45631256778978 100.73294878168024 L100.91262513557959 82.46589756336047 A100.0 100.0 0.0 0 1 194.0 19.0 L194.0 69.0 A50.0 50.0 0.0 0 0 147.45631256778978 100.73294878168024 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M194.0 69.0 L194.0 19.0 A100.0 100.0 0.0 1 1 179.09577338238256 217.88308262251286 L186.54788669119128 168.44154131125643 A50.0 50.0 0.0 1 0 194.0 69.0 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M186.54788669119128 168.44154131125643 L179.09577338238256 217.88308262251286 A100.0 100.0 0.0 0 1 150.61162608824418 209.0968867902419 L172.3058130441221 164.04844339512096 A50.0 50.0 0.0 0 0 186.54788669119128 168.44154131125643 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M172.3058130441221 164.04844339512096 L150.61162608824418 209.0968867902419 A100.0 100.0 0.0 0 1 100.91262513557956 82.46589756336054 L147.45631256778978 100.73294878168028 A50.0 50.0 0.0 0 0 172.3058130441221 164.04844339512096 \" fill=\"rgb(152,78,163)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M100.91262513557959 82.46589756336047 A100.0 100.0 0.0 0 1 194.0 19.0 M194.0 69.0 A50.0 50.0 0.0 0 0 147.45631256778978 100.73294878168024 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M194.0 19.0 A100.0 100.0 0.0 1 1 179.09577338238256 217.88308262251286 M186.54788669119128 168.44154131125643 A50.0 50.0 0.0 1 0 194.0 69.0 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M179.09577338238256 217.88308262251286 A100.0 100.0 0.0 0 1 150.61162608824418 209.0968867902419 M172.3058130441221 164.04844339512096 A50.0 50.0 0.0 0 0 186.54788669119128 168.44154131125643 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M150.61162608824418 209.0968867902419 A100.0 100.0 0.0 0 1 100.91262513557956 82.46589756336054 M147.45631256778978 100.73294878168028 A50.0 50.0 0.0 0 0 172.3058130441221 164.04844339512096 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M147.9217494421119 100.91561929386344 L100.44718826125748 82.28322705117728 M194.0 69.5 L194.0 18.5 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M194.0 69.5 L194.0 18.5 M186.62240782427935 167.94712589814387 L179.02125224929446 218.37749803562542 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M186.62240782427935 167.94712589814387 L179.02125224929446 218.37749803562542 M172.52275491368087 163.59795896116975 L150.39468421868543 209.5473712241931 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M172.52275491368087 163.59795896116975 L150.39468421868543 209.5473712241931 M147.9217494421119 100.91561929386347 L100.44718826125745 82.28322705117733 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 151.7509956452284 57.03209192630037 ) \">\n",
       "                <g transform=\"translate(151.7509956452284 61.832091926300365 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>a</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 268.7902847885885 124.60475701898183 ) \">\n",
       "                <g transform=\"translate(268.7902847885885 129.40475701898183 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>b</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 171.89336191918218 190.66796043396056 ) \">\n",
       "                <g transform=\"translate(171.89336191918218 195.46796043396057 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>c</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 124.18446885168468 146.40057682747965 ) \">\n",
       "                <g transform=\"translate(124.18446885168468 151.20057682747967 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>d</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cJ3q3b2\">\n",
       "            <rect x=\"0.0\" y=\"0.0\" width=\"388.0\" height=\"238.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(0.0 238.0 ) \">\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dVyaHNF\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"8d328e47-7eb2-4346-b3df-a4ee90df58b6\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p +\n",
    "    geomPie(\n",
    "        size = 20, stroke = 1, color = \"white\", hole = 0.5,\n",
    "        labels = layerLabels().line(\"@name\").size(16),\n",
    "        tooltips = tooltipContent\n",
    "    ) { fill = \"name\"; weight = \"value\" } +\n",
    "    blankTheme + \n",
    "    theme().legendPositionNone() +\n",
    "    scaleFillBrewer(palette = \"Set1\")    "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4772e96d",
   "metadata": {},
   "source": [
    "Order sectors by count.\n",
    "\n",
    "The following ordering rule is used for the pie chart: the first slice goes to the left of 12 o'clock and others go clockwise."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "90a172ad",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.789361Z",
     "iopub.status.busy": "2025-12-03T16:01:47.789067Z",
     "iopub.status.idle": "2025-12-03T16:01:47.846179Z",
     "shell.execute_reply": "2025-12-03T16:01:47.846050Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "data": {
         "name": [
          "a",
          "b",
          "c",
          "d",
          "b"
         ],
         "value": [
          40.0,
          90.0,
          10.0,
          50.0,
          20.0
         ]
        },
        "data_meta": {
         "series_annotations": [
          {
           "column": "value",
           "type": "int"
          }
         ]
        },
        "ggsize": {
         "height": 250.0,
         "width": 400.0
        },
        "kind": "plot",
        "layers": [
         {
          "color": "white",
          "data_meta": {
           "mapping_annotations": [
            {
             "aes": "fill",
             "annotation": "as_discrete",
             "parameters": {
              "label": "name",
              "order_by": "..count.."
             }
            }
           ]
          },
          "geom": "pie",
          "hole": 0.5,
          "labels": {
           "annotation_size": 16,
           "lines": [
            "@name"
           ]
          },
          "mapping": {
           "fill": "name",
           "weight": "value"
          },
          "position": "identity",
          "size": 20.0,
          "stat": "count2d",
          "stroke": 1.0,
          "tooltips": {
           "formats": [
            {
             "field": "..prop..",
             "format": ".0%"
            },
            {
             "field": "..count..",
             "format": ".1f"
            },
            {
             "field": "..sum..",
             "format": ".1f"
            }
           ],
           "lines": [
            "count|@{..count..} (@{..prop..})",
            "total|@{..sum..}"
           ]
          }
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "fill",
          "palette": "Set1",
          "scale_mapper_kind": "color_brewer"
         }
        ],
        "theme": {
         "axis": {
          "blank": true
         },
         "legend_position": "none",
         "line": {
          "blank": true
         }
        }
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"pbWAUb\" ></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"pbWAUb\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":400.0,\n",
       "\"height\":250.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"palette\":\"Set1\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"hole\":0.5,\n",
       "\"mapping\":{\n",
       "\"fill\":\"name\",\n",
       "\"weight\":\"value\"\n",
       "},\n",
       "\"stat\":\"count2d\",\n",
       "\"size\":20.0,\n",
       "\"color\":\"white\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"stroke\":1.0,\n",
       "\"data_meta\":{\n",
       "\"mapping_annotations\":[{\n",
       "\"aes\":\"fill\",\n",
       "\"annotation\":\"as_discrete\",\n",
       "\"parameters\":{\n",
       "\"label\":\"name\",\n",
       "\"order_by\":\"..count..\"\n",
       "}\n",
       "}]\n",
       "},\n",
       "\"tooltips\":{\n",
       "\"lines\":[\"count|@{..count..} (@{..prop..})\",\"total|@{..sum..}\"],\n",
       "\"formats\":[{\n",
       "\"field\":\"..prop..\",\n",
       "\"format\":\".0%\"\n",
       "},{\n",
       "\"field\":\"..count..\",\n",
       "\"format\":\".1f\"\n",
       "},{\n",
       "\"field\":\"..sum..\",\n",
       "\"format\":\".1f\"\n",
       "}]\n",
       "},\n",
       "\"labels\":{\n",
       "\"lines\":[\"@name\"],\n",
       "\"annotation_size\":16\n",
       "},\n",
       "\"data\":{\n",
       "\"..sum..\":[210.0,210.0,210.0,210.0],\n",
       "\"..count..\":[110.0,50.0,40.0,10.0],\n",
       "\"..x..\":[0.0,0.0,0.0,0.0],\n",
       "\"..y..\":[0.0,0.0,0.0,0.0],\n",
       "\"name\":[\"b\",\"d\",\"a\",\"c\"],\n",
       "\"..prop..\":[0.5238095238095238,0.23809523809523808,0.19047619047619047,0.047619047619047616]\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"legend_position\":\"none\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"value\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"11\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=304df50f-a744-4774-9587-9612b7d06ab8 width=\"100%\" height=\"100%\" style=\"max-width: 400.0px; max-height: 250.0px;\" viewBox=\"0 0 400.0 250.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#pglklZU .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#pglklZU .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pglklZU .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pglklZU .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#pglklZU .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pglklZU .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pglklZU .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pglklZU .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dwr2Vx8 .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pglklZU .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pglklZU .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dwr2Vx8 .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pglklZU .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pglklZU .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dwr2Vx8 .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dwr2Vx8 .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dwr2Vx8 .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"pglklZU\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(6.0 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#cioPPom)\" clip-bounds-jfx=\"[rect (0.0, 0.0), (388.0, 238.0)]\">\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <path d=\"M201.45211330880875 168.44154131125643 L208.9042266176175 217.88308262251286 A100.0 100.0 0.0 1 1 193.99999999999997 19.0 L193.99999999999997 69.0 A50.0 50.0 0.0 1 0 201.45211330880875 168.44154131125643 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M193.99999999999997 69.0 L193.99999999999997 19.0 A100.0 100.0 0.0 0 1 293.720379718118 111.52699064135753 L243.860189859059 115.26349532067876 A50.0 50.0 0.0 0 0 193.99999999999997 69.0 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M243.860189859059 115.26349532067876 L293.720379718118 111.52699064135753 A100.0 100.0 0.0 0 1 237.38837391175588 209.09688679024188 L215.69418695587794 164.04844339512096 A50.0 50.0 0.0 0 0 243.860189859059 115.26349532067876 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M215.69418695587794 164.04844339512096 L237.38837391175588 209.09688679024188 A100.0 100.0 0.0 0 1 208.9042266176175 217.88308262251286 L201.45211330880875 168.44154131125643 A50.0 50.0 0.0 0 0 215.69418695587794 164.04844339512096 \" fill=\"rgb(152,78,163)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M208.9042266176175 217.88308262251286 A100.0 100.0 0.0 1 1 193.99999999999997 19.0 M193.99999999999997 69.0 A50.0 50.0 0.0 1 0 201.45211330880875 168.44154131125643 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M193.99999999999997 19.0 A100.0 100.0 0.0 0 1 293.720379718118 111.52699064135753 M243.860189859059 115.26349532067876 A50.0 50.0 0.0 0 0 193.99999999999997 69.0 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M293.720379718118 111.52699064135753 A100.0 100.0 0.0 0 1 237.38837391175588 209.09688679024188 M215.69418695587794 164.04844339512096 A50.0 50.0 0.0 0 0 243.860189859059 115.26349532067876 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M237.38837391175588 209.09688679024188 A100.0 100.0 0.0 0 1 208.9042266176175 217.88308262251286 M201.45211330880875 168.44154131125643 A50.0 50.0 0.0 0 0 215.69418695587794 164.04844339512096 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M201.37759217572065 167.94712589814387 L208.97874775070557 218.37749803562542 M193.99999999999997 69.5 L193.99999999999997 18.5 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M193.99999999999997 69.5 L193.99999999999997 18.5 M243.36158796046843 115.30086036747197 L294.2189816167086 111.48962559456432 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M243.36158796046843 115.30086036747197 L294.2189816167086 111.48962559456432 M215.47724508631916 163.59795896116972 L237.60531578131466 209.54737122419309 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M215.47724508631916 163.59795896116972 L237.60531578131466 209.54737122419309 M201.37759217572068 167.94712589814387 L208.9787477507056 218.37749803562542 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 119.20971521141149 124.60475701898183 ) \">\n",
       "                <g transform=\"translate(119.20971521141149 129.40475701898183 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>b</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 245.01295533281893 64.021109612763 ) \">\n",
       "                <g transform=\"translate(245.01295533281893 68.821109612763 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>d</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 258.9519052838329 156.49999999999994 ) \">\n",
       "                <g transform=\"translate(258.9519052838329 161.29999999999995 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>a</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"rotate(0.0 216.10663808081787 190.66796043396053 ) \">\n",
       "                <g transform=\"translate(216.10663808081787 195.46796043396054 ) \">\n",
       "                  <text style=\"fill:#ffffff;font-size:16.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
       "                    <tspan>c</tspan>\n",
       "                  </text>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cioPPom\">\n",
       "            <rect x=\"0.0\" y=\"0.0\" width=\"388.0\" height=\"238.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(0.0 238.0 ) \">\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 250.0 L400.0 250.0 L400.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dwr2Vx8\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"304df50f-a744-4774-9587-9612b7d06ab8\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p +\n",
    "    geomPie(\n",
    "        size = 20, stroke = 1, color = \"white\", hole = 0.5,\n",
    "        labels = layerLabels().line(\"@name\").size(16),\n",
    "        tooltips = tooltipContent\n",
    "    ) { fill = asDiscrete(\"name\", orderBy = \"..count..\"); weight = \"value\" } +\n",
    "    blankTheme + \n",
    "    theme().legendPositionNone() +\n",
    "    scaleFillBrewer(palette = \"Set1\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2b506543",
   "metadata": {},
   "source": [
    "## 2. Pie size depending on data"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "40def630",
   "metadata": {},
   "source": [
    "Make the size of the pie chart dependent on the data: map total count ('..sum..' variable) to the `size`.\n",
    "\n",
    "Note that it has its own special representation of the size in the legend."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "407aa42e",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.847309Z",
     "iopub.status.busy": "2025-12-03T16:01:47.847106Z",
     "iopub.status.idle": "2025-12-03T16:01:47.967684Z",
     "shell.execute_reply": "2025-12-03T16:01:47.967815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "data": {
         "n": [
          "a",
          "b",
          "a",
          "c",
          "a",
          "a",
          "b",
          "c",
          "a",
          "b"
         ],
         "s": [
          3.0,
          1.0,
          2.0,
          1.0,
          4.0,
          1.0,
          3.0,
          3.0,
          3.0,
          1.0
         ],
         "x": [
          1.0,
          1.0,
          1.0,
          1.0,
          1.0,
          1.5,
          1.5,
          2.0,
          2.0,
          2.0
         ],
         "y": [
          1.0,
          1.0,
          1.0,
          1.0,
          1.0,
          2.0,
          2.0,
          1.5,
          1.5,
          1.5
         ]
        },
        "data_meta": {
         "series_annotations": [
          {
           "column": "x",
           "type": "int"
          },
          {
           "column": "y",
           "type": "int"
          },
          {
           "column": "s",
           "type": "int"
          }
         ]
        },
        "kind": "plot",
        "layers": [
         {
          "data_meta": {
           "mapping_annotations": [
            {
             "aes": "fill",
             "annotation": "as_discrete",
             "parameters": {
              "label": "n",
              "order": -1,
              "order_by": "..count.."
             }
            }
           ]
          },
          "geom": "pie",
          "hole": 0.3,
          "mapping": {
           "fill": "n",
           "size": "..sum..",
           "weight": "s",
           "x": "x",
           "y": "y"
          },
          "position": "identity",
          "stat": "count2d",
          "tooltips": {
           "formats": [
            {
             "field": "..prop..",
             "format": ".0%"
            },
            {
             "field": "..count..",
             "format": ".1f"
            },
            {
             "field": "..sum..",
             "format": ".1f"
            }
           ],
           "lines": [
            "count|@{..count..} (@{..prop..})",
            "total|@{..sum..}"
           ]
          }
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "x",
          "limits": [
           0.5,
           2.5
          ]
         },
         {
          "aesthetic": "y",
          "limits": [
           0.5,
           2.5
          ]
         }
        ]
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"g1t1IS\" ></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"g1t1IS\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"x\",\n",
       "\"limits\":[0.5,2.5]\n",
       "},{\n",
       "\"aesthetic\":\"y\",\n",
       "\"limits\":[0.5,2.5]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"hole\":0.3,\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\",\n",
       "\"size\":\"..sum..\",\n",
       "\"fill\":\"n\",\n",
       "\"weight\":\"s\"\n",
       "},\n",
       "\"stat\":\"count2d\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"data_meta\":{\n",
       "\"mapping_annotations\":[{\n",
       "\"aes\":\"fill\",\n",
       "\"annotation\":\"as_discrete\",\n",
       "\"parameters\":{\n",
       "\"label\":\"n\",\n",
       "\"order_by\":\"..count..\",\n",
       "\"order\":-1\n",
       "}\n",
       "}]\n",
       "},\n",
       "\"tooltips\":{\n",
       "\"lines\":[\"count|@{..count..} (@{..prop..})\",\"total|@{..sum..}\"],\n",
       "\"formats\":[{\n",
       "\"field\":\"..prop..\",\n",
       "\"format\":\".0%\"\n",
       "},{\n",
       "\"field\":\"..count..\",\n",
       "\"format\":\".1f\"\n",
       "},{\n",
       "\"field\":\"..sum..\",\n",
       "\"format\":\".1f\"\n",
       "}]\n",
       "},\n",
       "\"data\":{\n",
       "\"..sum..\":[11.0,4.0,7.0,11.0,7.0,11.0,4.0,7.0],\n",
       "\"..count..\":[9.0,1.0,3.0,1.0,3.0,1.0,3.0,1.0],\n",
       "\"x\":[1.0,1.5,2.0,1.0,2.0,1.0,1.5,2.0],\n",
       "\"y\":[1.0,2.0,1.5,1.0,1.5,1.0,2.0,1.5],\n",
       "\"..prop..\":[0.8181818181818182,0.25,0.42857142857142855,0.09090909090909091,0.42857142857142855,0.09090909090909091,0.75,0.14285714285714285],\n",
       "\"n\":[\"a\",\"a\",\"a\",\"c\",\"c\",\"b\",\"b\",\"b\"]\n",
       "}\n",
       "}],\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"x\"\n",
       "},{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"y\"\n",
       "},{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"s\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"13\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=219b9189-2b9a-4998-ac43-03587b056fb8 width=\"100%\" height=\"100%\" style=\"max-width: 600.0px; max-height: 400.0px;\" viewBox=\"0 0 600.0 400.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#p5xVbcE .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#p5xVbcE .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p5xVbcE .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p5xVbcE .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#p5xVbcE .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p5xVbcE .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p5xVbcE .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p5xVbcE .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dV2Xxei .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p5xVbcE .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#p5xVbcE .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dV2Xxei .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p5xVbcE .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#p5xVbcE .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dV2Xxei .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dV2Xxei .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dV2Xxei .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"p5xVbcE\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(21.0 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(23.034701220281416 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"19.63699023368399\" y1=\"0.0\" x2=\"19.63699023368399\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"117.82194140210399\" y1=\"0.0\" x2=\"117.82194140210399\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"216.00689257052397\" y1=\"0.0\" x2=\"216.00689257052397\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"314.191843738944\" y1=\"0.0\" x2=\"314.191843738944\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"412.376794907364\" y1=\"0.0\" x2=\"412.376794907364\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"translate(23.034701220281416 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"0.0\" y1=\"337.90909090909093\" x2=\"432.01378514104806\" y2=\"337.90909090909093\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"257.4545454545455\" x2=\"432.01378514104806\" y2=\"257.4545454545455\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"177.0\" x2=\"432.01378514104806\" y2=\"177.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"96.54545454545456\" x2=\"432.01378514104806\" y2=\"96.54545454545456\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"16.090909090909122\" x2=\"432.01378514104806\" y2=\"16.090909090909122\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#c0Hdr73)\" clip-bounds-jfx=\"[rect (23.034701220281416, 0.0), (432.01378514104806, 354.0)]\">\n",
       "        <g transform=\"translate(23.034701220281416 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <path d=\"M130.8462176992255 251.50655776838212 L161.23619572584235 237.6279198340009 A47.72727272727272 47.72727272727272 0.0 1 1 117.82194140210399 209.72727272727278 L117.82194140210399 243.13636363636368 A14.318181818181815 14.318181818181815 0.0 1 0 130.8462176992255 251.50655776838212 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M117.82194140210399 243.13636363636368 L117.82194140210399 209.72727272727278 A47.72727272727272 47.72727272727272 0.0 0 1 143.62525314430297 217.30380866033005 L125.56293492476368 245.40932441628087 A14.318181818181815 14.318181818181815 0.0 0 0 117.82194140210399 243.13636363636368 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M125.56293492476368 245.40932441628087 L143.62525314430297 217.30380866033005 A47.72727272727272 47.72727272727272 0.0 0 1 161.23619572584238 237.62791983400092 L130.8462176992255 251.50655776838212 A14.318181818181815 14.318181818181815 0.0 0 0 125.56293492476368 245.40932441628087 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M161.23619572584235 237.6279198340009 A47.72727272727272 47.72727272727272 0.0 1 1 117.82194140210399 209.72727272727278 M117.82194140210399 243.13636363636368 A14.318181818181815 14.318181818181815 0.0 1 0 130.8462176992255 251.50655776838212 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M117.82194140210399 209.72727272727278 A47.72727272727272 47.72727272727272 0.0 0 1 143.62525314430297 217.30380866033005 M125.56293492476368 245.40932441628087 A14.318181818181815 14.318181818181815 0.0 0 0 117.82194140210399 243.13636363636368 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M143.62525314430297 217.30380866033005 A47.72727272727272 47.72727272727272 0.0 0 1 161.23619572584238 237.62791983400092 M130.8462176992255 251.50655776838212 A14.318181818181815 14.318181818181815 0.0 0 0 125.56293492476368 245.40932441628087 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M130.50510570096756 251.66233839825782 L161.5773077241003 237.4721392041252 M117.82194140210399 243.51136363636368 L117.82194140210399 209.35227272727278 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M117.82194140210399 243.51136363636368 L117.82194140210399 209.35227272727278 M125.36019461821783 245.72479449109255 L143.82799345084882 216.98833858551836 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M125.36019461821783 245.72479449109255 L143.82799345084882 216.98833858551836 M130.50510570096756 251.66233839825784 L161.5773077241003 237.4721392041252 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M213.96143802506944 96.54545454545456 L209.18871075234216 96.54545454545456 A6.818181818181817 6.818181818181817 0.0 0 1 216.00689257052397 89.72727272727275 L216.00689257052397 94.50000000000001 A2.045454545454545 2.045454545454545 0.0 0 0 213.96143802506944 96.54545454545456 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M216.00689257052397 94.50000000000001 L216.00689257052397 89.72727272727275 A6.818181818181817 6.818181818181817 0.0 1 1 209.18871075234216 96.54545454545456 L213.96143802506944 96.54545454545456 A2.045454545454545 2.045454545454545 0.0 1 0 216.00689257052397 94.50000000000001 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M209.18871075234216 96.54545454545456 A6.818181818181817 6.818181818181817 0.0 0 1 216.00689257052397 89.72727272727275 M216.00689257052397 94.50000000000001 A2.045454545454545 2.045454545454545 0.0 0 0 213.96143802506944 96.54545454545456 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M216.00689257052397 89.72727272727275 A6.818181818181817 6.818181818181817 0.0 1 1 209.18871075234216 96.54545454545456 M213.96143802506944 96.54545454545456 A2.045454545454545 2.045454545454545 0.0 1 0 216.00689257052397 94.50000000000001 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M214.33643802506944 96.54545454545456 L208.81371075234216 96.54545454545456 M216.00689257052397 94.87500000000001 L216.00689257052397 89.35227272727275 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M216.00689257052397 94.87500000000001 L216.00689257052397 89.35227272727275 M214.33643802506944 96.54545454545456 L208.81371075234216 96.54545454545456 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M311.0222385018839 183.58175309344298 L303.6264929487437 198.9391769781433 A24.35064935064935 24.35064935064935 0.0 0 1 314.191843738944 152.64935064935065 L314.191843738944 169.69480519480518 A7.305194805194804 7.305194805194804 0.0 0 0 311.0222385018839 183.58175309344298 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M314.191843738944 169.69480519480518 L314.191843738944 152.64935064935065 A24.35064935064935 24.35064935064935 0.0 0 1 324.7571945291443 198.93917697814334 L317.36144897600406 183.58175309344298 A7.305194805194804 7.305194805194804 0.0 0 0 314.191843738944 169.69480519480518 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M317.36144897600406 183.58175309344298 L324.7571945291443 198.93917697814334 A24.35064935064935 24.35064935064935 0.0 0 1 303.6264929487437 198.93917697814334 L311.0222385018839 183.58175309344298 A7.305194805194804 7.305194805194804 0.0 0 0 317.36144897600406 183.58175309344298 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M303.6264929487437 198.9391769781433 A24.35064935064935 24.35064935064935 0.0 0 1 314.191843738944 152.64935064935065 M314.191843738944 169.69480519480518 A7.305194805194804 7.305194805194804 0.0 0 0 311.0222385018839 183.58175309344298 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M314.191843738944 152.64935064935065 A24.35064935064935 24.35064935064935 0.0 0 1 324.7571945291443 198.93917697814334 M317.36144897600406 183.58175309344298 A7.305194805194804 7.305194805194804 0.0 0 0 314.191843738944 169.69480519480518 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M324.7571945291443 198.93917697814334 A24.35064935064935 24.35064935064935 0.0 0 1 303.6264929487437 198.93917697814334 M311.0222385018839 183.58175309344298 A7.305194805194804 7.305194805194804 0.0 0 0 317.36144897600406 183.58175309344298 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M311.184944904053 183.2438897679796 L303.4637865465746 199.27704030360673 M314.191843738944 170.06980519480518 L314.191843738944 152.27435064935065 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M314.191843738944 170.06980519480518 L314.191843738944 152.27435064935065 M317.198742573835 183.2438897679796 L324.91990093131335 199.27704030360673 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M317.198742573835 183.2438897679796 L324.91990093131335 199.27704030360673 M311.184944904053 183.2438897679796 L303.4637865465746 199.27704030360673 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"c0Hdr73\">\n",
       "            <rect x=\"23.034701220281416\" y=\"0.0\" width=\"432.01378514104806\" height=\"354.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(23.034701220281416 354.0 ) \">\n",
       "          <g transform=\"translate(19.63699023368399 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 6.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
       "                <tspan>0.5</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(117.82194140210399 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 6.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
       "                <tspan>1</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(216.00689257052397 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 6.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
       "                <tspan>1.5</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(314.191843738944 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 6.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
       "                <tspan>2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(412.376794907364 0.0 ) \">\n",
       "            <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(0.0 6.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
       "                <tspan>2.5</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <line x1=\"0.0\" y1=\"0.0\" x2=\"432.01378514104806\" y2=\"0.0\" stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\">\n",
       "          </line>\n",
       "        </g>\n",
       "        <g transform=\"translate(23.034701220281416 0.0 ) \">\n",
       "          <g transform=\"translate(0.0 337.90909090909093 ) \">\n",
       "            <g transform=\"translate(-2.0 0.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
       "                <tspan>0.5</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 257.4545454545455 ) \">\n",
       "            <g transform=\"translate(-2.0 0.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
       "                <tspan>1</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 177.0 ) \">\n",
       "            <g transform=\"translate(-2.0 0.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
       "                <tspan>1.5</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 96.54545454545456 ) \">\n",
       "            <g transform=\"translate(-2.0 0.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
       "                <tspan>2</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 16.090909090909122 ) \">\n",
       "            <g transform=\"translate(-2.0 0.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
       "                <tspan>2.5</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(15.0 183.0 ) rotate(-90.0 ) \">\n",
       "      <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"axis-title-y\" text-anchor=\"middle\">\n",
       "        <tspan>y</tspan>\n",
       "      </text>\n",
       "    </g>\n",
       "    <g transform=\"translate(260.04159379080545 394.0 ) \">\n",
       "      <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"axis-title-x\" text-anchor=\"middle\">\n",
       "        <tspan>x</tspan>\n",
       "      </text>\n",
       "    </g>\n",
       "    <g transform=\"translate(479.0484863613295 1.5 ) \">\n",
       "      <rect x=\"0.0\" y=\"0.0\" height=\"251.5\" width=\"117.9515136386705\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\">\n",
       "      </rect>\n",
       "      <g transform=\"translate(5.0 5.0 ) \">\n",
       "        <g transform=\"translate(0.0 12.0 ) \">\n",
       "          <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"legend-title\">\n",
       "            <tspan>sum</tspan>\n",
       "          </text>\n",
       "        </g>\n",
       "        <g transform=\"translate(0.0 22.5 ) \">\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"43.0\" cy=\"10.5\" r=\"6.818181818181817\" fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(91.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>4</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 23.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"43.0\" cy=\"20.0\" r=\"18.506493506493506\" fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(91.9903027277341 21.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>6</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 65.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"43.0\" cy=\"32.0\" r=\"30.19480519480519\" fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(91.9903027277341 33.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>8</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 131.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"43.0\" cy=\"43.0\" r=\"41.88311688311687\" fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(91.9903027277341 44.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>10</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(479.0484863613295 263.0 ) \">\n",
       "      <rect x=\"0.0\" y=\"0.0\" height=\"101.5\" width=\"44.970908183202305\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\">\n",
       "      </rect>\n",
       "      <g transform=\"translate(5.0 5.0 ) \">\n",
       "        <g transform=\"translate(0.0 12.0 ) \">\n",
       "          <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"legend-title\">\n",
       "            <tspan>n</tspan>\n",
       "          </text>\n",
       "        </g>\n",
       "        <g transform=\"translate(0.0 22.5 ) \">\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(228,26,28)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>a</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 23.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(55,126,184)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>c</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 46.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(77,175,74)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>b</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dV2Xxei\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"219b9189-2b9a-4998-ac43-03587b056fb8\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val data2 = mapOf(\n",
    "    \"x\" to listOf(1, 1, 1, 1, 1, 1.5, 1.5,   2,   2,   2),\n",
    "    \"y\" to listOf(1, 1, 1, 1, 1,   2,   2, 1.5, 1.5, 1.5),\n",
    "    \"s\" to listOf(3, 1, 2, 1, 4,   1,   3,   3,   3,  1),\n",
    "    \"n\" to listOf('a', 'b', 'a', 'c', 'a',  'a', 'b', 'c', 'a',  'b')\n",
    ")\n",
    "\n",
    "\n",
    "letsPlot(data2) +\n",
    "    geomPie(hole = 0.3, tooltips = tooltipContent) { \n",
    "        x = \"x\"\n",
    "        y = \"y\"\n",
    "        fill = asDiscrete(\"n\", orderBy = \"..count..\", order = -1)\n",
    "        weight = \"s\"\n",
    "        size = \"..sum..\"\n",
    "    } +\n",
    "    xlim(0.5 to 2.5) + ylim(0.5 to 2.5)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fa9e9195",
   "metadata": {},
   "source": [
    "Mapping `fill` and `size` to the same variable:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "fc4c8b13",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:47.969814Z",
     "iopub.status.busy": "2025-12-03T16:01:47.969485Z",
     "iopub.status.idle": "2025-12-03T16:01:48.023912Z",
     "shell.execute_reply": "2025-12-03T16:01:48.024032Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "data": {
         "n": [
          "a",
          "b",
          "c"
         ],
         "s": [
          1.0,
          2.0,
          3.0
         ]
        },
        "data_meta": {
         "series_annotations": [
          {
           "column": "n",
           "type": "str"
          },
          {
           "column": "s",
           "type": "int"
          }
         ]
        },
        "kind": "plot",
        "layers": [
         {
          "geom": "pie",
          "mapping": {
           "fill": "n",
           "size": "n",
           "slice": "s"
          },
          "position": "identity",
          "stat": "identity"
         }
        ],
        "mapping": {},
        "scales": [],
        "theme": {
         "axis": {
          "blank": true
         },
         "line": {
          "blank": true
         }
        }
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"j9OSFr\" ></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"j9OSFr\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"s\":[1.0,2.0,3.0],\n",
       "\"n\":[\"a\",\"b\",\"c\"]\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"slice\":\"s\",\n",
       "\"size\":\"n\",\n",
       "\"fill\":\"n\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "}\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"n\"\n",
       "},{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"s\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"15\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=16a6083d-2fe1-4519-9432-f2a5509f1102 width=\"100%\" height=\"100%\" style=\"max-width: 600.0px; max-height: 400.0px;\" viewBox=\"0 0 600.0 400.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#pKbFpDY .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#pKbFpDY .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pKbFpDY .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pKbFpDY .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#pKbFpDY .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pKbFpDY .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pKbFpDY .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pKbFpDY .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dA8FREq .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pKbFpDY .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pKbFpDY .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dA8FREq .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pKbFpDY .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pKbFpDY .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dA8FREq .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dA8FREq .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dA8FREq .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"pKbFpDY\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(6.0 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#cw0XzsJ)\" clip-bounds-jfx=\"[rect (0.0, 0.0), (466.0290918167977, 388.0)]\">\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <path d=\"M233.01454590839884 194.0 L227.10982724623221 190.5909090909091 A6.8181818181818175 6.8181818181818175 0.0 0 1 233.01454590839884 187.1818181818182 L233.01454590839884 194.0 A0.0 0.0 0.0 0 0 233.01454590839884 194.0 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M233.01454590839884 194.0 L233.01454590839884 166.72727272727272 A27.27272727272727 27.27272727272727 0.0 0 1 256.63342055706534 207.63636363636363 L233.01454590839884 194.0 A0.0 0.0 0.0 0 0 233.01454590839884 194.0 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M233.01454590839884 194.0 L274.34757654356525 217.86363636363637 A47.72727272727273 47.72727272727273 0.0 0 1 191.68151527323246 170.13636363636363 L233.01454590839884 194.0 A0.0 0.0 0.0 0 0 233.01454590839884 194.0 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M227.10982724623221 190.5909090909091 A6.8181818181818175 6.8181818181818175 0.0 0 1 233.01454590839884 187.1818181818182 M233.01454590839884 194.0 A0.0 0.0 0.0 0 0 233.01454590839884 194.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M233.01454590839884 166.72727272727272 A27.27272727272727 27.27272727272727 0.0 0 1 256.63342055706534 207.63636363636363 M233.01454590839884 194.0 A0.0 0.0 0.0 0 0 233.01454590839884 194.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M274.34757654356525 217.86363636363637 A47.72727272727273 47.72727272727273 0.0 0 1 191.68151527323246 170.13636363636363 M233.01454590839884 194.0 A0.0 0.0 0.0 0 0 233.01454590839884 194.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M233.01454590839884 194.0 L226.78506771981304 190.4034090909091 M233.01454590839884 194.0 L233.01454590839884 186.8068181818182 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M233.01454590839884 194.0 L233.01454590839884 166.35227272727272 M233.01454590839884 194.0 L256.95818008348454 207.82386363636363 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M233.01454590839884 194.0 L274.6723360699844 218.05113636363637 M233.01454590839884 194.0 L191.3567557468133 169.94886363636363 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cw0XzsJ\">\n",
       "            <rect x=\"0.0\" y=\"0.0\" width=\"466.0290918167977\" height=\"388.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(0.0 388.0 ) \">\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(475.0290918167977 92.25 ) \">\n",
       "      <rect x=\"0.0\" y=\"0.0\" height=\"215.5\" width=\"121.97090818320231\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\">\n",
       "      </rect>\n",
       "      <g transform=\"translate(5.0 5.0 ) \">\n",
       "        <g transform=\"translate(0.0 12.0 ) \">\n",
       "          <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"legend-title\">\n",
       "            <tspan>n</tspan>\n",
       "          </text>\n",
       "        </g>\n",
       "        <g transform=\"translate(0.0 22.5 ) \">\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"49.0\" cy=\"10.5\" r=\"6.8181818181818175\" fill=\"rgb(228,26,28)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(103.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>a</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 23.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"49.0\" cy=\"29.0\" r=\"27.27272727272727\" fill=\"rgb(55,126,184)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(103.9903027277341 30.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>b</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 83.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"49.0\" cy=\"49.0\" r=\"47.72727272727273\" fill=\"rgb(77,175,74)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(103.9903027277341 50.0 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>c</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dA8FREq\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"16a6083d-2fe1-4519-9432-f2a5509f1102\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "letsPlot(data = mapOf(\"n\" to listOf(\"a\", \"b\", \"c\"), \"s\" to listOf(1, 2, 3))) + \n",
    "    geomPie(stat = Stat.identity) { fill = \"n\"; slice = \"s\"; size = \"n\" } +\n",
    "    blankTheme"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "06bd6ffc",
   "metadata": {},
   "source": [
    "## 3. Explode"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5f244752",
   "metadata": {},
   "source": [
    "Use values to explode slices away from their center point, detaching it from the main pie."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "56e5d9b3",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:48.025542Z",
     "iopub.status.busy": "2025-12-03T16:01:48.025320Z",
     "iopub.status.idle": "2025-12-03T16:01:48.098097Z",
     "shell.execute_reply": "2025-12-03T16:01:48.098169Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "data": {
         "count": [
          1109.0,
          696.0,
          353.0,
          192.0,
          168.0,
          86.0,
          74.0,
          65.0,
          53.0
         ],
         "explode": [
          0.0,
          0.0,
          0.0,
          0.1,
          0.1,
          0.2,
          0.3,
          0.4,
          0.6
         ],
         "name": [
          "20-50 km",
          "50-75 km",
          "10-20 km",
          "75-100 km",
          "3-5 km",
          "7-10 km",
          "5-7 km",
          ">100 km",
          "2-3 km"
         ]
        },
        "data_meta": {
         "series_annotations": [
          {
           "column": "name",
           "type": "str"
          },
          {
           "column": "count",
           "type": "int"
          },
          {
           "column": "explode",
           "type": "int"
          }
         ]
        },
        "kind": "plot",
        "layers": [
         {
          "color": "black",
          "geom": "pie",
          "mapping": {
           "explode": "explode",
           "fill": "name",
           "slice": "count"
          },
          "position": "identity",
          "size": 20.0,
          "stat": "identity",
          "stroke": 1.0
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "fill",
          "high": "light_green",
          "low": "dark_blue",
          "scale_mapper_kind": "color_gradient"
         }
        ],
        "theme": {
         "axis": {
          "blank": true
         },
         "line": {
          "blank": true
         }
        }
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"BmePl5\" ></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"BmePl5\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"explode\":[0.0,0.0,0.0,0.1,0.1,0.2,0.3,0.4,0.6],\n",
       "\"name\":[\"20-50 km\",\"50-75 km\",\"10-20 km\",\"75-100 km\",\"3-5 km\",\"7-10 km\",\"5-7 km\",\">100 km\",\"2-3 km\"],\n",
       "\"count\":[1109.0,696.0,353.0,192.0,168.0,86.0,74.0,65.0,53.0]\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_gradient\",\n",
       "\"high\":\"light_green\",\n",
       "\"low\":\"dark_blue\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"slice\":\"count\",\n",
       "\"explode\":\"explode\",\n",
       "\"fill\":\"name\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":20.0,\n",
       "\"color\":\"black\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"stroke\":1.0,\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "}\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"name\"\n",
       "},{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"count\"\n",
       "},{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"explode\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"17\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=2c1db8cc-0bb4-44d3-8a79-36a03c0c452b width=\"100%\" height=\"100%\" style=\"max-width: 600.0px; max-height: 400.0px;\" viewBox=\"0 0 600.0 400.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#poJuUu9 .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#poJuUu9 .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#poJuUu9 .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#poJuUu9 .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#poJuUu9 .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#poJuUu9 .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#poJuUu9 .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#poJuUu9 .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d9UAa1K .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#poJuUu9 .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#poJuUu9 .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d9UAa1K .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#poJuUu9 .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#poJuUu9 .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d9UAa1K .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d9UAa1K .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#d9UAa1K .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"poJuUu9\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(6.0 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g clip-path=\"url(#cUQ1rog)\" clip-bounds-jfx=\"[rect (0.0, 0.0), (478.70648929740446, 388.0)]\">\n",
       "        <g transform=\"\">\n",
       "          <g>\n",
       "            <g>\n",
       "              <g>\n",
       "                <path d=\"M239.35324464870223 194.0 L178.87901441115528 273.6421212498522 A100.0 100.0 0.0 0 1 239.35324464870223 94.0 L239.35324464870223 194.0 A0.0 0.0 0.0 0 0 239.35324464870223 194.0 \" fill=\"rgb(0,0,139)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M239.35324464870223 194.0 L239.35324464870223 94.0 A100.0 100.0 0.0 0 1 339.35097218857663 193.32584359304573 L239.35324464870223 194.0 A0.0 0.0 0.0 0 0 239.35324464870223 194.0 \" fill=\"rgb(53,37,142)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M239.35324464870223 194.0 L339.35097218857663 193.32584359304573 A100.0 100.0 0.0 0 1 309.9844274522588 264.7900841627595 L239.35324464870223 194.0 A0.0 0.0 0.0 0 0 239.35324464870223 194.0 \" fill=\"rgb(77,65,144)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M244.737291874738 202.426863916536 L315.36847467829455 273.21694807929555 A100.0 100.0 0.0 0 1 279.2910124987032 296.2673689825306 L244.737291874738 202.426863916536 A0.0 0.0 0.0 0 0 244.737291874738 202.426863916536 \" fill=\"rgb(95,93,146)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M240.98635646893922 203.8657460834243 L275.5400770929044 297.7062511494189 A100.0 100.0 0.0 0 1 238.51468265276733 303.835195559484 L240.98635646893922 203.8657460834243 A0.0 0.0 0.0 0 0 240.98635646893922 203.8657460834243 \" fill=\"rgb(109,121,147)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M236.93221527410768 213.85292464014685 L234.4605414579358 313.82237411620656 A100.0 100.0 0.0 0 1 215.30653707064857 311.48657684183615 L236.93221527410768 213.85292464014685 A0.0 0.0 0.0 0 0 236.93221527410768 213.85292464014685 \" fill=\"rgb(121,149,148)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M230.45538781924685 222.65009849620964 L208.82970961578775 320.283750697899 A100.0 100.0 0.0 0 1 192.96694919646788 315.3572555533977 L230.45538781924685 222.65009849620964 A0.0 0.0 0.0 0 0 230.45538781924685 222.65009849620964 \" fill=\"rgb(131,178,148)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M221.69193517240774 229.88980562196667 L184.20349654962877 322.59696267915473 A100.0 100.0 0.0 0 1 171.10923482792407 316.1532997887356 L221.69193517240774 229.88980562196667 A0.0 0.0 0.0 0 0 221.69193517240774 229.88980562196667 \" fill=\"rgb(138,208,146)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M205.97700164766007 243.8600682223298 L155.3943013031764 330.1235623890987 A100.0 100.0 0.0 0 1 145.50277141011316 323.502189472182 L205.97700164766007 243.8600682223298 A0.0 0.0 0.0 0 0 205.97700164766007 243.8600682223298 \" fill=\"rgb(144,238,144)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M178.87901441115528 273.6421212498522 A100.0 100.0 0.0 0 1 239.35324464870223 94.0 M239.35324464870223 194.0 A0.0 0.0 0.0 0 0 239.35324464870223 194.0 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M239.35324464870223 94.0 A100.0 100.0 0.0 0 1 339.35097218857663 193.32584359304573 M239.35324464870223 194.0 A0.0 0.0 0.0 0 0 239.35324464870223 194.0 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M339.35097218857663 193.32584359304573 A100.0 100.0 0.0 0 1 309.9844274522588 264.7900841627595 M239.35324464870223 194.0 A0.0 0.0 0.0 0 0 239.35324464870223 194.0 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M315.36847467829455 273.21694807929555 A100.0 100.0 0.0 0 1 279.2910124987032 296.2673689825306 M244.737291874738 202.426863916536 A0.0 0.0 0.0 0 0 244.737291874738 202.426863916536 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M275.5400770929044 297.7062511494189 A100.0 100.0 0.0 0 1 238.51468265276733 303.835195559484 M240.98635646893922 203.8657460834243 A0.0 0.0 0.0 0 0 240.98635646893922 203.8657460834243 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M234.4605414579358 313.82237411620656 A100.0 100.0 0.0 0 1 215.30653707064857 311.48657684183615 M236.93221527410768 213.85292464014685 A0.0 0.0 0.0 0 0 236.93221527410768 213.85292464014685 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M208.82970961578775 320.283750697899 A100.0 100.0 0.0 0 1 192.96694919646788 315.3572555533977 M230.45538781924685 222.65009849620964 A0.0 0.0 0.0 0 0 230.45538781924685 222.65009849620964 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M184.20349654962877 322.59696267915473 A100.0 100.0 0.0 0 1 171.10923482792407 316.1532997887356 M221.69193517240774 229.88980562196667 A0.0 0.0 0.0 0 0 221.69193517240774 229.88980562196667 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M155.3943013031764 330.1235623890987 A100.0 100.0 0.0 0 1 145.50277141011316 323.502189472182 M205.97700164766007 243.8600682223298 A0.0 0.0 0.0 0 0 205.97700164766007 243.8600682223298 \" fill=\"none\" stroke-width=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M239.35324464870223 194.0 L239.35324464870223 93.5 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M239.35324464870223 194.0 L239.35324464870223 93.5 M239.35324464870223 194.0 L339.85096082627604 193.32247281101095 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"M239.35324464870223 194.0 L339.85096082627604 193.32247281101095 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"\" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"\" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"\" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"\" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"\" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "              <g>\n",
       "                <path d=\"\" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                </path>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cUQ1rog\">\n",
       "            <rect x=\"0.0\" y=\"0.0\" width=\"478.70648929740446\" height=\"388.0\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(0.0 388.0 ) \">\n",
       "        </g>\n",
       "        <g transform=\"\">\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(487.70648929740446 80.25 ) \">\n",
       "      <rect x=\"0.0\" y=\"0.0\" height=\"239.5\" width=\"109.29351070259553\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\">\n",
       "      </rect>\n",
       "      <g transform=\"translate(5.0 5.0 ) \">\n",
       "        <g transform=\"translate(0.0 12.0 ) \">\n",
       "          <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"legend-title\">\n",
       "            <tspan>name</tspan>\n",
       "          </text>\n",
       "        </g>\n",
       "        <g transform=\"translate(0.0 22.5 ) \">\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(0,0,139)\" fill-opacity=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>20-50 km</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 23.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(53,37,142)\" fill-opacity=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>50-75 km</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 46.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(77,65,144)\" fill-opacity=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>10-20 km</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 69.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(95,93,146)\" fill-opacity=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>75-100 km</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 92.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(109,121,147)\" fill-opacity=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>3-5 km</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 115.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(121,149,148)\" fill-opacity=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>7-10 km</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 138.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(131,178,148)\" fill-opacity=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>5-7 km</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 161.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(138,208,146)\" fill-opacity=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>&gt;100 km</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 184.0 ) \">\n",
       "            <g>\n",
       "              <g transform=\"translate(1.0 1.0 ) \">\n",
       "                <g>\n",
       "                  <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(144,238,144)\" fill-opacity=\"1.0\" stroke=\"rgb(0,0,0)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                  </circle>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                <tspan>2-3 km</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "    </g>\n",
       "    <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"d9UAa1K\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"2c1db8cc-0bb4-44d3-8a79-36a03c0c452b\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val length = mapOf(\n",
    "  \"name\" to listOf(\"20-50 km\", \"50-75 km\", \"10-20 km\", \"75-100 km\", \"3-5 km\", \"7-10 km\", \"5-7 km\", \">100 km\", \"2-3 km\"),\n",
    "  \"count\" to listOf(1109, 696, 353, 192, 168, 86, 74, 65, 53),\n",
    "  \"explode\" to listOf(0, 0, 0, 0.1, 0.1, 0.2, 0.3, 0.4, 0.6)\n",
    ")\n",
    "\n",
    "ggplot(length) + blankTheme +\n",
    "    geomPie(stat = Stat.identity, stroke = 1, color = \"black\", size = 20) {\n",
    "        fill = \"name\"; slice = \"count\"; explode = \"explode\"\n",
    "    } +\n",
    "    scaleFillGradient(low = \"dark_blue\", high = \"light_green\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "5953f8aa",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:01:48.099210Z",
     "iopub.status.busy": "2025-12-03T16:01:48.099071Z",
     "iopub.status.idle": "2025-12-03T16:01:48.204903Z",
     "shell.execute_reply": "2025-12-03T16:01:48.204978Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "figures": [
         {
          "data": {
           "explode": [
            0.1,
            0.0,
            0.0,
            0.0
           ],
           "label": [
            "Apples",
            "Bananas",
            "Cherries",
            "Dates"
           ],
           "slice": [
            35.0,
            25.0,
            25.0,
            15.0
           ]
          },
          "data_meta": {
           "series_annotations": [
            {
             "column": "slice",
             "type": "int"
            },
            {
             "column": "label",
             "type": "str"
            },
            {
             "column": "explode",
             "type": "float"
            }
           ]
          },
          "ggsize": {
           "height": 250.0,
           "width": 400.0
          },
          "kind": "plot",
          "layers": [
           {
            "geom": "pie",
            "mapping": {
             "explode": "explode",
             "fill": "label",
             "slice": "slice"
            },
            "position": "identity",
            "size": 18.0,
            "stat": "identity"
           }
          ],
          "mapping": {},
          "scales": [
           {
            "aesthetic": "fill",
            "palette": "Set1",
            "scale_mapper_kind": "color_brewer"
           }
          ],
          "theme": {
           "axis": {
            "blank": true
           },
           "legend_position": "none",
           "line": {
            "blank": true
           }
          }
         },
         {
          "data": {
           "explode": [
            0.1,
            0.0,
            0.0,
            0.0
           ],
           "label": [
            "Apples",
            "Bananas",
            "Cherries",
            "Dates"
           ],
           "slice": [
            35.0,
            25.0,
            25.0,
            15.0
           ]
          },
          "data_meta": {
           "series_annotations": [
            {
             "column": "slice",
             "type": "int"
            },
            {
             "column": "label",
             "type": "str"
            },
            {
             "column": "explode",
             "type": "float"
            }
           ]
          },
          "ggsize": {
           "height": 250.0,
           "width": 400.0
          },
          "kind": "plot",
          "layers": [
           {
            "geom": "pie",
            "hole": 0.8,
            "mapping": {
             "explode": "explode",
             "fill": "label",
             "slice": "slice"
            },
            "position": "identity",
            "size": 18.0,
            "stat": "identity"
           }
          ],
          "mapping": {},
          "scales": [
           {
            "aesthetic": "fill",
            "palette": "Set1",
            "scale_mapper_kind": "color_brewer"
           }
          ],
          "theme": {
           "axis": {
            "blank": true
           },
           "line": {
            "blank": true
           }
          }
         }
        ],
        "ggsize": {
         "height": 250.0,
         "width": 800.0
        },
        "kind": "subplots",
        "layout": {
         "align": false,
         "fit": true,
         "name": "grid",
         "ncol": 2,
         "nrow": 1
        }
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"W59Cel\" ></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "   \n",
       "   (function() {\n",
       "   // ----------\n",
       "   \n",
       "   const forceImmediateRender = false;\n",
       "   const responsive = false;\n",
       "   \n",
       "   let sizing = {\n",
       "       width_mode: \"MIN\",\n",
       "       height_mode: \"SCALED\",\n",
       "       width: null, \n",
       "       height: null \n",
       "   };\n",
       "   \n",
       "   const preferredWidth = document.body.dataset.letsPlotPreferredWidth;\n",
       "   if (preferredWidth !== undefined) {\n",
       "       sizing = {\n",
       "           width_mode: 'FIXED',\n",
       "           height_mode: 'SCALED',\n",
       "           width: parseFloat(preferredWidth)\n",
       "       };\n",
       "   }\n",
       "   \n",
       "   const containerDiv = document.getElementById(\"W59Cel\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"layout\":{\n",
       "\"name\":\"grid\",\n",
       "\"ncol\":2,\n",
       "\"nrow\":1,\n",
       "\"fit\":true,\n",
       "\"align\":false\n",
       "},\n",
       "\"figures\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"slice\":[35.0,25.0,25.0,15.0],\n",
       "\"explode\":[0.1,0.0,0.0,0.0],\n",
       "\"label\":[\"Apples\",\"Bananas\",\"Cherries\",\"Dates\"]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":400.0,\n",
       "\"height\":250.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"palette\":\"Set1\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"slice\":\"slice\",\n",
       "\"explode\":\"explode\",\n",
       "\"fill\":\"label\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":18.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"legend_position\":\"none\"\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"slice\"\n",
       "},{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"label\"\n",
       "},{\n",
       "\"type\":\"float\",\n",
       "\"column\":\"explode\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"19\"\n",
       "},{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "\"slice\":[35.0,25.0,25.0,15.0],\n",
       "\"explode\":[0.1,0.0,0.0,0.0],\n",
       "\"label\":[\"Apples\",\"Bananas\",\"Cherries\",\"Dates\"]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":400.0,\n",
       "\"height\":250.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_brewer\",\n",
       "\"palette\":\"Set1\"\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"hole\":0.8,\n",
       "\"mapping\":{\n",
       "\"slice\":\"slice\",\n",
       "\"explode\":\"explode\",\n",
       "\"fill\":\"label\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"size\":18.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"pie\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"line\":{\n",
       "\"blank\":true\n",
       "}\n",
       "},\n",
       "\"data_meta\":{\n",
       "\"series_annotations\":[{\n",
       "\"type\":\"int\",\n",
       "\"column\":\"slice\"\n",
       "},{\n",
       "\"type\":\"str\",\n",
       "\"column\":\"label\"\n",
       "},{\n",
       "\"type\":\"float\",\n",
       "\"column\":\"explode\"\n",
       "}]\n",
       "},\n",
       "\"spec_id\":\"20\"\n",
       "}],\n",
       "\"ggsize\":{\n",
       "\"width\":800.0,\n",
       "\"height\":250.0\n",
       "},\n",
       "\"kind\":\"subplots\"\n",
       "};\n",
       "           window.letsPlotCall(function() { fig = LetsPlot.buildPlotFromProcessedSpecs(plotSpec, containerDiv, sizing); });\n",
       "       } else {\n",
       "           fig.updateView({});\n",
       "       }\n",
       "   }\n",
       "   \n",
       "   const renderImmediately = \n",
       "       forceImmediateRender || (\n",
       "           sizing.width_mode === 'FIXED' && \n",
       "           (sizing.height_mode === 'FIXED' || sizing.height_mode === 'SCALED')\n",
       "       );\n",
       "   \n",
       "   if (renderImmediately) {\n",
       "       renderPlot();\n",
       "   }\n",
       "   \n",
       "   if (!renderImmediately || responsive) {\n",
       "       // Set up observer for initial sizing or continuous monitoring\n",
       "       var observer = new ResizeObserver(function(entries) {\n",
       "           for (let entry of entries) {\n",
       "               if (entry.contentBoxSize && \n",
       "                   entry.contentBoxSize[0].inlineSize > 0) {\n",
       "                   if (!responsive && observer) {\n",
       "                       observer.disconnect();\n",
       "                       observer = null;\n",
       "                   }\n",
       "                   renderPlot();\n",
       "                   if (!responsive) {\n",
       "                       break;\n",
       "                   }\n",
       "               }\n",
       "           }\n",
       "       });\n",
       "       \n",
       "       observer.observe(containerDiv);\n",
       "   }\n",
       "   \n",
       "   // ----------\n",
       "   })();\n",
       "   \n",
       "   </script>                <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" id=778aca2d-f8d3-4c72-a7ee-cebc3ff0e4c2 width=\"100%\" height=\"100%\" style=\"max-width: 800.0px; max-height: 250.0px;\" viewBox=\"0 0 800.0 250.0\" preserveAspectRatio=\"xMinYMin meet\">\n",
       "  <style type=\"text/css\">\n",
       "  .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#ptDGu3Y .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       ".axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       ".axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#ptDGu3Y .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       ".tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       ".tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       ".tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "  </style>\n",
       "  <g id=\"ptDGu3Y\">\n",
       "    <rect x=\"0.0\" y=\"0.0\" height=\"250.0\" width=\"800.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\">\n",
       "    </rect>\n",
       "  </g>\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" width=\"392.0\" height=\"238.0\" x=\"6.0\" y=\"6.0\">\n",
       "    <style type=\"text/css\">\n",
       "    .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#pVg7KnT .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#pVg7KnT .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pVg7KnT .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pVg7KnT .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#pVg7KnT .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pVg7KnT .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pVg7KnT .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pVg7KnT .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dl3B4hT .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pVg7KnT .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pVg7KnT .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dl3B4hT .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pVg7KnT .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pVg7KnT .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dl3B4hT .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dl3B4hT .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dl3B4hT .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "    </style>\n",
       "    <g id=\"pVg7KnT\">\n",
       "      <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 238.0 L392.0 238.0 L392.0 0.0 Z\">\n",
       "      </path>\n",
       "      <g transform=\"translate(6.0 6.0 ) \">\n",
       "        <g>\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g clip-path=\"url(#cYME39L)\" clip-bounds-jfx=\"[rect (0.0, 0.0), (380.0, 226.0)]\">\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "              <g>\n",
       "                <g>\n",
       "                  <path d=\"M181.98094128230468 108.91408550234408 L109.1694117885594 161.81475820866666 A90.0 90.0 0.0 0 1 181.98094128230468 18.91408550234408 L181.98094128230468 108.91408550234408 A0.0 0.0 0.0 0 0 181.98094128230468 108.91408550234408 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M190.0 113.0 L190.0 23.0 A90.0 90.0 0.0 0 1 280.0 113.0 L190.0 113.0 A0.0 0.0 0.0 0 0 190.0 113.0 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M190.0 113.0 L280.0 113.0 A90.0 90.0 0.0 0 1 190.0 203.0 L190.0 113.0 A0.0 0.0 0.0 0 0 190.0 113.0 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M190.0 113.0 L190.0 203.0 A90.0 90.0 0.0 0 1 117.18847050625475 165.9006727063226 L190.0 113.0 A0.0 0.0 0.0 0 0 190.0 113.0 \" fill=\"rgb(152,78,163)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M109.1694117885594 161.81475820866666 A90.0 90.0 0.0 0 1 181.98094128230468 18.91408550234408 M181.98094128230468 108.91408550234408 A0.0 0.0 0.0 0 0 181.98094128230468 108.91408550234408 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M190.0 23.0 A90.0 90.0 0.0 0 1 280.0 113.0 M190.0 113.0 A0.0 0.0 0.0 0 0 190.0 113.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M280.0 113.0 A90.0 90.0 0.0 0 1 190.0 203.0 M190.0 113.0 A0.0 0.0 0.0 0 0 190.0 113.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M190.0 203.0 A90.0 90.0 0.0 0 1 117.18847050625475 165.9006727063226 M190.0 113.0 A0.0 0.0 0.0 0 0 190.0 113.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"\" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M190.0 113.0 L280.375 113.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M190.0 113.0 L280.375 113.0 M190.0 113.0 L190.0 203.375 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M190.0 113.0 L190.0 203.375 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "          <defs>\n",
       "            <clipPath id=\"cYME39L\">\n",
       "              <rect x=\"0.0\" y=\"0.0\" width=\"380.0\" height=\"226.0\">\n",
       "              </rect>\n",
       "            </clipPath>\n",
       "          </defs>\n",
       "        </g>\n",
       "        <g>\n",
       "          <g transform=\"translate(0.0 226.0 ) \">\n",
       "          </g>\n",
       "          <g transform=\"\">\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 238.0 L392.0 238.0 L392.0 0.0 Z\" pointer-events=\"none\">\n",
       "      </path>\n",
       "    </g>\n",
       "    <g id=\"dl3B4hT\">\n",
       "    </g>\n",
       "  </svg>\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" display=\"block\" class=\"plt-container\" width=\"392.0\" height=\"238.0\" x=\"402.0\" y=\"6.0\">\n",
       "    <style type=\"text/css\">\n",
       "    .plt-container {\n",
       "   font-family: sans-serif;\n",
       "   user-select: none;\n",
       "   -webkit-user-select: none;\n",
       "   -moz-user-select: none;\n",
       "   -ms-user-select: none;\n",
       "}\n",
       "text {\n",
       "   text-rendering: optimizeLegibility;\n",
       "}\n",
       "#pzRXlYh .plot-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 16.0px;\n",
       "\n",
       "}\n",
       "#pzRXlYh .plot-subtitle {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pzRXlYh .plot-caption {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pzRXlYh .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#pzRXlYh .legend-title {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pzRXlYh .legend-item {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pzRXlYh .axis-title-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pzRXlYh .axis-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dciGPeS .axis-tooltip-text-x {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pzRXlYh .axis-title-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 15.0px;\n",
       "\n",
       "}\n",
       "#pzRXlYh .axis-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dciGPeS .axis-tooltip-text-y {\n",
       "fill: #ffffff;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pzRXlYh .facet-strip-text-x {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#pzRXlYh .facet-strip-text-y {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dciGPeS .tooltip-text {\n",
       "fill: #474747;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dciGPeS .tooltip-title {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "#dciGPeS .tooltip-label {\n",
       "fill: #474747;\n",
       "font-weight: bold;\n",
       "font-style: normal;\n",
       "font-family: sans-serif;\n",
       "font-size: 13.0px;\n",
       "\n",
       "}\n",
       "\n",
       "    </style>\n",
       "    <g id=\"pzRXlYh\">\n",
       "      <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 238.0 L392.0 238.0 L392.0 0.0 Z\">\n",
       "      </path>\n",
       "      <g transform=\"translate(6.0 6.0 ) \">\n",
       "        <g>\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <g clip-path=\"url(#cL4BtYt)\" clip-bounds-jfx=\"[rect (0.0, 0.0), (285.2785026964189, 226.0)]\">\n",
       "          <g transform=\"\">\n",
       "            <g>\n",
       "              <g>\n",
       "                <g>\n",
       "                  <path d=\"M76.37096903551792 151.23462366740213 L61.80866313676886 161.81475820866666 A90.0 90.0 0.0 0 1 134.62019263051414 18.91408550234408 L134.62019263051414 36.91408550234408 A72.0 72.0 0.0 0 0 76.37096903551792 151.23462366740213 \" fill=\"rgb(228,26,28)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M142.63925134820946 41.0 L142.63925134820946 23.0 A90.0 90.0 0.0 0 1 232.63925134820946 113.0 L214.63925134820946 113.0 A72.0 72.0 0.0 0 0 142.63925134820946 41.0 \" fill=\"rgb(55,126,184)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M214.63925134820946 113.0 L232.63925134820946 113.0 A90.0 90.0 0.0 0 1 142.63925134820946 203.0 L142.63925134820946 185.0 A72.0 72.0 0.0 0 0 214.63925134820946 113.0 \" fill=\"rgb(77,175,74)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M142.63925134820946 185.0 L142.63925134820946 203.0 A90.0 90.0 0.0 0 1 69.8277218544642 165.9006727063226 L84.39002775321325 155.32053816505808 A72.0 72.0 0.0 0 0 142.63925134820946 185.0 \" fill=\"rgb(152,78,163)\" stroke-width=\"1.0\" fill-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M61.80866313676886 161.81475820866666 A90.0 90.0 0.0 0 1 134.62019263051414 18.91408550234408 M134.62019263051414 36.91408550234408 A72.0 72.0 0.0 0 0 76.37096903551792 151.23462366740213 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M142.63925134820946 23.0 A90.0 90.0 0.0 0 1 232.63925134820946 113.0 M214.63925134820946 113.0 A72.0 72.0 0.0 0 0 142.63925134820946 41.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M232.63925134820946 113.0 A90.0 90.0 0.0 0 1 142.63925134820946 203.0 M142.63925134820946 185.0 A72.0 72.0 0.0 0 0 214.63925134820946 113.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M142.63925134820946 203.0 A90.0 90.0 0.0 0 1 69.8277218544642 165.9006727063226 M84.39002775321325 155.32053816505808 A72.0 72.0 0.0 0 0 142.63925134820946 185.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"\" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M214.26425134820946 113.0 L233.01425134820946 113.0 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M214.26425134820946 113.0 L233.01425134820946 113.0 M142.63925134820946 184.625 L142.63925134820946 203.375 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "                <g>\n",
       "                  <path d=\"M142.63925134820946 184.625 L142.63925134820946 203.375 \" fill=\"none\" stroke-width=\"0.75\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "                  </path>\n",
       "                </g>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "          <defs>\n",
       "            <clipPath id=\"cL4BtYt\">\n",
       "              <rect x=\"0.0\" y=\"0.0\" width=\"285.2785026964189\" height=\"226.0\">\n",
       "              </rect>\n",
       "            </clipPath>\n",
       "          </defs>\n",
       "        </g>\n",
       "        <g>\n",
       "          <g transform=\"translate(0.0 226.0 ) \">\n",
       "          </g>\n",
       "          <g transform=\"\">\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <g transform=\"translate(294.2785026964189 56.75 ) \">\n",
       "        <rect x=\"0.0\" y=\"0.0\" height=\"124.5\" width=\"94.72149730358109\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\">\n",
       "        </rect>\n",
       "        <g transform=\"translate(5.0 5.0 ) \">\n",
       "          <g transform=\"translate(0.0 12.0 ) \">\n",
       "            <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"legend-title\">\n",
       "              <tspan>label</tspan>\n",
       "            </text>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 22.5 ) \">\n",
       "            <g transform=\"\">\n",
       "              <g>\n",
       "                <g transform=\"translate(1.0 1.0 ) \">\n",
       "                  <g>\n",
       "                    <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(228,26,28)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                    </circle>\n",
       "                  </g>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "                <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                  <tspan>Apples</tspan>\n",
       "                </text>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(0.0 23.0 ) \">\n",
       "              <g>\n",
       "                <g transform=\"translate(1.0 1.0 ) \">\n",
       "                  <g>\n",
       "                    <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(55,126,184)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                    </circle>\n",
       "                  </g>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "                <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                  <tspan>Bananas</tspan>\n",
       "                </text>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(0.0 46.0 ) \">\n",
       "              <g>\n",
       "                <g transform=\"translate(1.0 1.0 ) \">\n",
       "                  <g>\n",
       "                    <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(77,175,74)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                    </circle>\n",
       "                  </g>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "                <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                  <tspan>Cherries</tspan>\n",
       "                </text>\n",
       "              </g>\n",
       "            </g>\n",
       "            <g transform=\"translate(0.0 69.0 ) \">\n",
       "              <g>\n",
       "                <g transform=\"translate(1.0 1.0 ) \">\n",
       "                  <g>\n",
       "                    <circle cx=\"10.5\" cy=\"10.5\" r=\"5.0\" fill=\"rgb(152,78,163)\" fill-opacity=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.75\">\n",
       "                    </circle>\n",
       "                  </g>\n",
       "                </g>\n",
       "              </g>\n",
       "              <g transform=\"translate(26.9903027277341 11.5 ) \">\n",
       "                <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\" dy=\"0.35em\">\n",
       "                  <tspan>Dates</tspan>\n",
       "                </text>\n",
       "              </g>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "      </g>\n",
       "      <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 238.0 L392.0 238.0 L392.0 0.0 Z\" pointer-events=\"none\">\n",
       "      </path>\n",
       "    </g>\n",
       "    <g id=\"dciGPeS\">\n",
       "    </g>\n",
       "  </svg>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"778aca2d-f8d3-4c72-a7ee-cebc3ff0e4c2\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val calories = mapOf(\n",
    "    \"slice\" to listOf(35, 25, 25, 15),\n",
    "    \"label\" to listOf(\"Apples\", \"Bananas\", \"Cherries\", \"Dates\"),\n",
    "    \"explode\" to listOf(0.1, 0, 0, 0)\n",
    ")\n",
    "\n",
    "val p4 = ggplot(calories) +\n",
    "    blankTheme +\n",
    "    scaleFillBrewer(palette=\"Set1\") +\n",
    "    ggsize(w, h)\n",
    "\n",
    "gggrid(plots = listOf(\n",
    "    p4 + geomPie(stat = Stat.identity, size = 18) {\n",
    "        fill = \"label\"; slice = \"slice\"; explode = \"explode\"\n",
    "    } + theme().legendPositionNone(),\n",
    "    p4 + geomPie(stat = Stat.identity, size = 18, hole = 0.8) {\n",
    "        fill = \"label\"; slice = \"slice\"; explode = \"explode\"\n",
    "    }),\n",
    "       ncol = 2\n",
    ") + ggsize(2 * w, h)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Kotlin",
   "language": "kotlin",
   "name": "kotlin"
  },
  "language_info": {
   "codemirror_mode": "text/x-kotlin",
   "file_extension": ".kt",
   "mimetype": "text/x-kotlin",
   "name": "kotlin",
   "nbconvert_exporter": "",
   "pygments_lexer": "kotlin",
   "version": "2.2.20-Beta2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
