source/kotlin_examples/cookbook/boxplot_whisker_width.ipynb (973 lines of code) (raw):

{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "developed-feeling", "metadata": { "execution": { "iopub.execute_input": "2025-12-03T15:57:29.169215Z", "iopub.status.busy": "2025-12-03T15:57:29.167708Z", "iopub.status.idle": "2025-12-03T15:57:31.125737Z", "shell.execute_reply": "2025-12-03T15:57:31.125378Z" } }, "outputs": [ { "data": { "text/html": [ " <div id=\"vxObaw\"></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(\"vxObaw\").appendChild(div);\n", " };\n", " var e = document.getElementById(\"vxObaw\");\n", " e.appendChild(script);\n", " })();\n", " </script>" ] }, "metadata": {}, "output_type": "display_data" }, { "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[\"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_0\");\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_0\").appendChild(div);\n", " }, false);\n", " \n", " e.appendChild(script);\n", " });\n", " })();\n", " </script>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%useLatestDescriptors\n", "%use lets-plot" ] }, { "cell_type": "code", "execution_count": 2, "id": "composite-liver", "metadata": { "execution": { "iopub.execute_input": "2025-12-03T15:57:31.127229Z", "iopub.status.busy": "2025-12-03T15:57:31.126965Z", "iopub.status.idle": "2025-12-03T15:57:31.163700Z", "shell.execute_reply": "2025-12-03T15:57:31.163819Z" } }, "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": "global-lease", "metadata": { "execution": { "iopub.execute_input": "2025-12-03T15:57:31.166662Z", "iopub.status.busy": "2025-12-03T15:57:31.166143Z", "iopub.status.idle": "2025-12-03T15:57:31.592533Z", "shell.execute_reply": "2025-12-03T15:57:31.592614Z" } }, "outputs": [ { "data": { "text/html": [ " <div id=\"Jwrw2x\"></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(\"Jwrw2x\").appendChild(div);\n", " };\n", " var e = document.getElementById(\"Jwrw2x\");\n", " e.appendChild(script);\n", " })();\n", " </script>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/plot+json": { "apply_color_scheme": true, "output": { "data": { "x": [ "b", "b", "b", "a", "a", "c", "a", "b", "c", "b", "b", "a", "a", "b", "b", "a", "b", "a", "b", "b", "a", "a", "a", "a", "b", "a", "c", "c", "a", "a", "c", "c", "a", "a", "a", "b", "c", "c", "c", "b", "b", "b", "b", "c", "c", "b", "b", "c", "a", "c", "c", "a", "b", "c", "c", "c", "c", "b", "a", "b", "a", "c", "b", "c", "a", "a", "b", "b", "a", "a", "c", "b", "c", "c", "b", "b", "c", "c", "a", "a", "b", "b", "a", "a", "a", "a", "b", "c", "c", "b", "a", "b", "a", "b", "c", "c", "a", "c", "a", "b" ], "y": [ 1.7687943677666822, 0.10628211826095219, 1.7204367528361415, -0.037534100873246996, -0.7556292895100587, -0.9951161662703086, 1.052027068066767, -0.6497562324361997, -0.47969604178646064, 1.3195412359422278, 0.6471885375454148, -0.6145630713451975, 0.21099118887163767, 0.83061591557465, 0.4890950549463388, 1.3037914453654387, 0.9791647128033308, -1.304372469120525, -0.6739853262611326, -0.6302272555314844, -0.06567293517548581, 0.16992439572141083, 0.4985272158114654, 0.3744336799283743, 0.8193988829709237, 2.429780509168998, 0.35327583135456675, 0.34645985018170156, 0.564510581840672, 1.1079917758816, -2.20104878328904, 1.9695418127098692, -0.2364138746138622, -0.9260104971066431, -0.23550283017719809, -0.01921041177944297, -0.8623579647574651, -0.04184743225913421, -0.34086213093508905, 0.6989387291958685, -0.21280602574129706, -1.5229462883897182, -1.114669649931767, -0.7246596018824761, -0.9795078835494803, 0.43048299121850986, 0.5860946664293265, 0.411783051565248, 2.439598419520245, -0.30589367627540626, -0.03625210379296746, -0.01523713036011583, 0.6748592497714744, 0.449083044780863, 0.7510927431339195, -0.209489786045136, -0.7633801278093398, -0.37577099825301746, 0.14629225501397528, -0.03366700906389058, -0.4992531374770084, 0.5161937494021966, 0.5548153186535513, -0.5079465545590672, -1.021287990885576, 1.8600533054767678, -1.3941301234610528, -0.5876750570891159, 0.27922173427881986, -1.1260343908468196, -1.577245894169239, 1.6868507959809638, -0.34315520906864366, 0.8756673838511702, -0.013202904846600071, 0.1663109595197368, 0.25926468816943765, 0.6214371542812759, 0.40713450838998066, 0.05660059883189231, -0.5927007106253308, 0.2144892451035325, 0.6705129011671771, -0.4192229557817511, -0.13399160735362278, -1.5234992785571666, -0.5760061861059607, 2.2972205355496347, 2.162580230059769, 1.0480461096358216, 1.0609063932362777, -1.3878584214688807, 0.6502887453513964, -1.494802096457127, 0.698933409561582, 1.0279802603891166, -0.7139967016700057, -0.7226340957160897, 0.2725587805228503, -0.10652537707272984 ] }, "data_meta": { "series_annotations": [ { "column": "x", "type": "str" }, { "column": "y", "type": "float" } ] }, "kind": "plot", "layers": [ { "geom": "boxplot", "mapping": {}, "position": "dodge", "stat": "boxplot", "whisker_width": 0.2 }, { "geom": "point", "mapping": {}, "position": "dodge", "show_legend": false, "stat": "boxplot_outlier" } ], "mapping": { "x": "x", "y": "y" }, "scales": [] }, "output_type": "lets_plot_spec", "swing_enabled": true }, "text/html": [ " <div id=\"0WU9w1\" ></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(\"0WU9w1\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "\"x\":\"x\",\n", "\"y\":\"y\"\n", "},\n", "\"data\":{\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[],\n", "\"layers\":[{\n", "\"mapping\":{\n", "},\n", "\"stat\":\"boxplot\",\n", "\"whisker_width\":0.2,\n", "\"position\":\"dodge\",\n", "\"geom\":\"boxplot\",\n", "\"data\":{\n", "\"..middle..\":[0.10628211826095219,0.14629225501397528,-0.03904976802605084],\n", "\"..upper..\":[0.6868989894836715,0.6073996635960341,0.5688154518417363],\n", "\"..ymax..\":[1.7687943677666822,1.8600533054767678,2.2972205355496347],\n", "\"..lower..\":[-0.5901878838572234,-0.4592380466293797,-0.6152903251375785],\n", "\"x\":[\"b\",\"a\",\"c\"],\n", "\"..ymin..\":[-1.5229462883897182,-1.5234992785571666,-2.20104878328904]\n", "}\n", "},{\n", "\"mapping\":{\n", "},\n", "\"stat\":\"boxplot_outlier\",\n", "\"show_legend\":false,\n", "\"position\":\"dodge\",\n", "\"geom\":\"point\",\n", "\"data\":{\n", "\"..middle..\":[0.10628211826095219,0.14629225501397528,0.14629225501397528,-0.03904976802605084],\n", "\"..upper..\":[0.6868989894836715,0.6073996635960341,0.6073996635960341,0.5688154518417363],\n", "\"..ymax..\":[1.7687943677666822,1.8600533054767678,1.8600533054767678,2.2972205355496347],\n", "\"..lower..\":[-0.5901878838572234,-0.4592380466293797,-0.4592380466293797,-0.6152903251375785],\n", "\"x\":[\"b\",\"a\",\"a\",\"c\"],\n", "\"y\":[NaN,2.429780509168998,2.439598419520245,NaN],\n", "\"..ymin..\":[-1.5229462883897182,-1.5234992785571666,-1.5234992785571666,-2.20104878328904]\n", "}\n", "}],\n", "\"data_meta\":{\n", "\"series_annotations\":[{\n", "\"type\":\"str\",\n", "\"column\":\"x\"\n", "},{\n", "\"type\":\"float\",\n", "\"column\":\"y\"\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=a2242164-610e-4913-8011-28d0d9dc00a2 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", "#pNxmSde .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", "#pNxmSde .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", "#pNxmSde .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", "#pNxmSde .hyperlink-element {\n", "fill: #118ed8;\n", "font-weight: normal;\n", "font-style: normal;\n", "\n", "}\n", "#pNxmSde .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", "#pNxmSde .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", "#pNxmSde .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", "#pNxmSde .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", "#d0uBN2F .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", "#pNxmSde .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", "#pNxmSde .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", "#d0uBN2F .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", "#pNxmSde .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", "#pNxmSde .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", "#d0uBN2F .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", "#d0uBN2F .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", "#d0uBN2F .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=\"pNxmSde\">\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(31.015306675749617 0.0 ) \">\n", " <g>\n", " <line x1=\"106.75456080629174\" y1=\"0.0\" x2=\"106.75456080629174\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"270.99234666212516\" y1=\"0.0\" x2=\"270.99234666212516\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"435.2301325179586\" y1=\"0.0\" x2=\"435.2301325179586\" 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(31.015306675749617 0.0 ) \">\n", " <g>\n", " <line x1=\"0.0\" y1=\"323.9668214222683\" x2=\"541.9846933242504\" y2=\"323.9668214222683\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"0.0\" y1=\"289.2929744615077\" x2=\"541.9846933242504\" y2=\"289.2929744615077\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"0.0\" y1=\"254.6191275007471\" x2=\"541.9846933242504\" y2=\"254.6191275007471\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"0.0\" y1=\"219.94528053998653\" x2=\"541.9846933242504\" y2=\"219.94528053998653\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"0.0\" y1=\"185.2714335792259\" x2=\"541.9846933242504\" y2=\"185.2714335792259\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"0.0\" y1=\"150.5975866184653\" x2=\"541.9846933242504\" y2=\"150.5975866184653\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"0.0\" y1=\"115.92373965770472\" x2=\"541.9846933242504\" y2=\"115.92373965770472\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"0.0\" y1=\"81.24989269694412\" x2=\"541.9846933242504\" y2=\"81.24989269694412\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"0.0\" y1=\"46.57604573618352\" x2=\"541.9846933242504\" y2=\"46.57604573618352\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n", " </line>\n", " <line x1=\"0.0\" y1=\"11.902198775422903\" x2=\"541.9846933242504\" y2=\"11.902198775422903\" 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(#cz8p7dU)\" clip-bounds-jfx=\"[rect (31.015306675749617, 0.0), (541.9846933242504, 354.0)]\">\n", " <g transform=\"translate(31.015306675749617 0.0 ) \">\n", " <g>\n", " <g>\n", " <rect x=\"32.847557171166684\" y=\"137.63657270151006\" height=\"88.56302960363689\" width=\"147.8140072702501\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" stroke-width=\"1.6500000000000001\">\n", " </rect>\n", " <rect x=\"197.08534302700014\" y=\"143.1496676201332\" height=\"73.96886545386423\" width=\"147.8140072702501\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" stroke-width=\"1.6500000000000001\">\n", " </rect>\n", " <rect x=\"361.32312888283354\" y=\"145.8253937270734\" height=\"82.11500499266657\" width=\"147.81400727025016\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" stroke-width=\"1.6500000000000001\">\n", " </rect>\n", " <line x1=\"32.847557171166684\" y1=\"177.90101377273447\" x2=\"180.66156444141677\" y2=\"177.90101377273447\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"3.3000000000000003\">\n", " </line>\n", " <line x1=\"197.08534302700014\" y1=\"175.12640305542763\" x2=\"344.89935029725024\" y2=\"175.12640305542763\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"3.3000000000000003\">\n", " </line>\n", " <line x1=\"361.32312888283354\" y1=\"187.9794449400029\" x2=\"509.1371361530837\" y2=\"187.9794449400029\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"3.3000000000000003\">\n", " </line>\n", " <line x1=\"106.75456080629174\" y1=\"226.19960230514695\" x2=\"106.75456080629174\" y2=\"290.88424664539286\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"91.97316007926672\" y1=\"290.88424664539286\" x2=\"121.53596153331675\" y2=\"290.88424664539286\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"106.75456080629174\" y1=\"137.63657270151006\" x2=\"106.75456080629174\" y2=\"62.60962315323144\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"91.97316007926672\" y1=\"62.60962315323144\" x2=\"121.53596153331675\" y2=\"62.60962315323144\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"270.99234666212516\" y1=\"217.1185330739974\" x2=\"270.99234666212516\" y2=\"290.9225952382667\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"256.21094593510014\" y1=\"290.9225952382667\" x2=\"285.7737473891502\" y2=\"290.9225952382667\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"270.99234666212516\" y1=\"143.1496676201332\" x2=\"270.99234666212516\" y2=\"56.28102627330924\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"256.21094593510014\" y1=\"56.28102627330924\" x2=\"285.7737473891502\" y2=\"56.28102627330924\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"435.2301325179586\" y1=\"227.94039871973996\" x2=\"435.2301325179586\" y2=\"337.9090909090909\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"420.4487317909336\" y1=\"337.9090909090909\" x2=\"450.0115332449836\" y2=\"337.9090909090909\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"435.2301325179586\" y1=\"145.8253937270734\" x2=\"435.2301325179586\" y2=\"25.964487009696853\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " <line x1=\"420.4487317909336\" y1=\"25.964487009696853\" x2=\"450.0115332449836\" y2=\"25.964487009696853\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" fill=\"none\" stroke-width=\"1.6500000000000001\">\n", " </line>\n", " </g>\n", " <g>\n", " <g>\n", " <g >\n", " <circle fill=\"#474747\" stroke=\"#474747\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"270.99234666212516\" cy=\"16.771758532896285\" r=\"3.3000000000000003\" />\n", " <circle fill=\"#474747\" stroke=\"#474747\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"270.99234666212516\" cy=\"16.090909090909093\" r=\"3.3000000000000003\" />\n", " </g>\n", " </g>\n", " </g>\n", " </g>\n", " </g>\n", " <defs>\n", " <clipPath id=\"cnOtAZS\">\n", " <rect x=\"31.015306675749617\" y=\"0.0\" width=\"541.9846933242504\" height=\"354.0\">\n", " </rect>\n", " </clipPath>\n", " </defs>\n", " <defs>\n", " <clipPath id=\"cz8p7dU\">\n", " <rect x=\"31.015306675749617\" y=\"0.0\" width=\"541.9846933242504\" height=\"354.0\">\n", " </rect>\n", " </clipPath>\n", " </defs>\n", " </g>\n", " <g>\n", " <g transform=\"translate(31.015306675749617 354.0 ) \">\n", " <g transform=\"translate(106.75456080629174 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>b</tspan>\n", " </text>\n", " </g>\n", " </g>\n", " <g transform=\"translate(270.99234666212516 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>a</tspan>\n", " </text>\n", " </g>\n", " </g>\n", " <g transform=\"translate(435.2301325179586 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>c</tspan>\n", " </text>\n", " </g>\n", " </g>\n", " <line x1=\"0.0\" y1=\"0.0\" x2=\"541.9846933242504\" 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 323.9668214222683 ) \">\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 289.2929744615077 ) \">\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 254.6191275007471 ) \">\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 219.94528053998653 ) \">\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 185.2714335792259 ) \">\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 150.5975866184653 ) \">\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 115.92373965770472 ) \">\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 81.24989269694412 ) \">\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 46.57604573618352 ) \">\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 11.902198775422903 ) \">\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(323.00765333787484 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", " <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=\"d0uBN2F\">\n", " </g>\n", "</svg>\n", " <script>document.getElementById(\"a2242164-610e-4913-8011-28d0d9dc00a2\").style.display = \"none\";</script>" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "val n = 100\n", "val rand = java.util.Random(37)\n", "val data = mapOf<String, Any>(\n", " \"x\" to List(n) { listOf(\"a\", \"b\", \"c\").random() },\n", " \"y\" to List(n) { rand.nextGaussian() }\n", ")\n", "\n", "letsPlot(data) { x = \"x\"; y = \"y\" } + geomBoxplot(whiskerWidth = 0.2)" ] } ], "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 }