{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## geomImshow()\n",
    "\n",
    "`geomImshow()` displays an image specified by 2D or 3D array.\n",
    "\n",
    "Whether the image is grayscale or color depends on the shape of the image array:\n",
    "- (M, N) - grey-scale image\n",
    "- (M, N, 3) - color RGB image\n",
    "- (M, N, 4) - color RGB image with alpha channel\n",
    "\n",
    "By default, all values in the image array will be transformed to the range [0-255] using a linear scaler."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:04:14.822625Z",
     "iopub.status.busy": "2025-12-03T16:04:14.821132Z",
     "iopub.status.idle": "2025-12-03T16:04:16.874486Z",
     "shell.execute_reply": "2025-12-03T16:04:16.874132Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"RsMk2r\"></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(\"RsMk2r\").appendChild(div);\n",
       "           };\n",
       "           var e = document.getElementById(\"RsMk2r\");\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,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:04:16.876892Z",
     "iopub.status.busy": "2025-12-03T16:04:16.876436Z",
     "iopub.status.idle": "2025-12-03T16:04:16.910760Z",
     "shell.execute_reply": "2025-12-03T16:04:16.910561Z"
    }
   },
   "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": "markdown",
   "metadata": {},
   "source": [
    "### Grayscale image\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:04:16.913216Z",
     "iopub.status.busy": "2025-12-03T16:04:16.912654Z",
     "iopub.status.idle": "2025-12-03T16:04:17.172398Z",
     "shell.execute_reply": "2025-12-03T16:04:17.172278Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"LFMhgx\"></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(\"LFMhgx\").appendChild(div);\n",
       "           };\n",
       "           var e = document.getElementById(\"LFMhgx\");\n",
       "           e.appendChild(script);\n",
       "       })();\n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "kind": "plot",
        "layers": [
         {
          "color_by": "paint_c",
          "geom": "image",
          "href": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAAAAAC4HznGAAAAEElEQVR42mNgWPWf4X8oAwAMpgL+0LIbjQAAAABJRU5ErkJggg==",
          "inherit_aes": false,
          "mapping": {
           "paint_c": [
            50.0,
            200.0
           ]
          },
          "stat": "identity",
          "xmax": 2.5,
          "xmin": -0.5,
          "ymax": 1.5,
          "ymin": -0.5
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "paint_c",
          "end": 1.0,
          "name": "",
          "scale_mapper_kind": "color_grey",
          "start": 0.0
         }
        ]
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"ySChJq\" ></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(\"ySChJq\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"paint_c\",\n",
       "\"scale_mapper_kind\":\"color_grey\",\n",
       "\"name\":\"\",\n",
       "\"start\":0.0,\n",
       "\"end\":1.0\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "\"paint_c\":\"paint_c\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":1.5,\n",
       "\"xmax\":2.5,\n",
       "\"color_by\":\"paint_c\",\n",
       "\"inherit_aes\":false,\n",
       "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAAAAAC4HznGAAAAEElEQVR42mNgWPWf4X8oAwAMpgL+0LIbjQAAAABJRU5ErkJggg==\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "\"paint_c\":[50.0,200.0]\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=f6760751-2b19-4066-ab20-08b729f7fa4c 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",
       "#p0UFr2u .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",
       "#p0UFr2u .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",
       "#p0UFr2u .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",
       "#p0UFr2u .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#p0UFr2u .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",
       "#p0UFr2u .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",
       "#p0UFr2u .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",
       "#p0UFr2u .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",
       "#dfnmKrb .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",
       "#p0UFr2u .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",
       "#p0UFr2u .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",
       "#dfnmKrb .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",
       "#p0UFr2u .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",
       "#p0UFr2u .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",
       "#dfnmKrb .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",
       "#dfnmKrb .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",
       "#dfnmKrb .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=\"p0UFr2u\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 16.64914192329607 L0.0 383.35085807670396 L600.0 383.35085807670396 L600.0 16.64914192329607 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(21.0 22.64914192329607 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"21.866026101368718\" y1=\"0.0\" x2=\"21.866026101368718\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"94.75277977259776\" y1=\"0.0\" x2=\"94.75277977259776\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"167.6395334438268\" y1=\"0.0\" x2=\"167.6395334438268\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"240.52628711505585\" y1=\"0.0\" x2=\"240.52628711505585\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"313.4130407862849\" y1=\"0.0\" x2=\"313.4130407862849\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"386.29979445751394\" y1=\"0.0\" x2=\"386.29979445751394\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"459.18654812874297\" y1=\"0.0\" x2=\"459.18654812874297\" y2=\"320.70171615340786\" 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=\"306.124365419162\" x2=\"481.0525742301117\" y2=\"306.124365419162\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"233.237611747933\" x2=\"481.0525742301117\" y2=\"233.237611747933\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"160.35085807670393\" x2=\"481.0525742301117\" y2=\"160.35085807670393\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"87.46410440547487\" x2=\"481.0525742301117\" y2=\"87.46410440547487\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"14.577350734245812\" x2=\"481.0525742301117\" y2=\"14.577350734245812\" 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(#ciRTw14)\" clip-bounds-jfx=\"[rect (31.015306675749617, 0.0), (481.0525742301117, 320.70171615340786)]\">\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <image preserveAspectRatio=\"none\" x=\"21.866026101368718\" y=\"14.577350734245812\" width=\"437.32052202737424\" height=\"291.54701468491623\" xlink:href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAAAAAC4HznGAAAAEElEQVR42mNgWPWf4X8oAwAMpgL+0LIbjQAAAABJRU5ErkJggg==\" style=\"image-rendering: optimizeSpeed; image-rendering: pixelated\">\n",
       "              </image>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"ciRTw14\">\n",
       "            <rect x=\"31.015306675749617\" y=\"0.0\" width=\"481.0525742301117\" height=\"320.70171615340786\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 320.70171615340786 ) \">\n",
       "          <g transform=\"translate(21.866026101368718 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(94.75277977259776 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(167.6395334438268 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(240.52628711505585 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(313.4130407862849 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(386.29979445751394 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(459.18654812874297 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=\"481.0525742301117\" 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 306.124365419162 ) \">\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 233.237611747933 ) \">\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 160.35085807670393 ) \">\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 87.46410440547487 ) \">\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 14.577350734245812 ) \">\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>\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(292.54159379080545 377.35085807670396 ) \">\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(536.0678809058613 120.5 ) \">\n",
       "      <rect x=\"0.0\" y=\"0.0\" height=\"125.0\" width=\"60.932119094138706\" 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=\"\">\n",
       "          <g>\n",
       "            <rect x=\"0.0\" y=\"0.0\" height=\"115.0\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(248,248,248)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"7.55\" height=\"107.45\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(233,233,233)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"13.1\" height=\"101.9\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(219,219,219)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"18.65\" height=\"96.35\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(205,205,205)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"24.2\" height=\"90.8\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(191,191,191)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"29.75\" height=\"85.25\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(178,178,178)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"35.3\" height=\"79.7\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(164,164,164)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"40.849999999999994\" height=\"74.15\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(151,151,151)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"46.39999999999999\" height=\"68.60000000000001\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(138,138,138)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"51.94999999999999\" height=\"63.05000000000001\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(125,125,125)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"57.499999999999986\" height=\"57.500000000000014\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(113,113,113)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"63.04999999999998\" height=\"51.95000000000002\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(100,100,100)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"68.59999999999998\" height=\"46.40000000000002\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(88,88,88)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"74.14999999999998\" height=\"40.85000000000002\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(76,76,76)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"79.69999999999997\" height=\"35.300000000000026\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(65,65,65)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"85.24999999999997\" height=\"29.75000000000003\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(54,54,54)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"90.79999999999997\" height=\"24.20000000000003\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(43,43,43)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"96.34999999999997\" height=\"18.650000000000034\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(33,33,33)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"101.89999999999996\" height=\"13.100000000000037\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(23,23,23)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"107.44999999999996\" height=\"7.55000000000004\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(9,9,9)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <line x1=\"0.0\" y1=\"113.0\" x2=\"4.0\" y2=\"113.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"113.0\" x2=\"23.0\" y2=\"113.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 117.55 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>50</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "            <line x1=\"0.0\" y1=\"76.0\" x2=\"4.0\" y2=\"76.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"76.0\" x2=\"23.0\" y2=\"76.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 80.55 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>100</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "            <line x1=\"0.0\" y1=\"39.0\" x2=\"4.0\" y2=\"39.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"39.0\" x2=\"23.0\" y2=\"39.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 43.55 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>150</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "            <line x1=\"0.0\" y1=\"2.0\" x2=\"4.0\" y2=\"2.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"2.0\" x2=\"23.0\" y2=\"2.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 6.549999999999999 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>200</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 16.64914192329607 L0.0 383.35085807670396 L600.0 383.35085807670396 L600.0 16.64914192329607 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dfnmKrb\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"f6760751-2b19-4066-ab20-08b729f7fa4c\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val A2x3 = RasterData.create(\n",
    "    listOf(\n",
    "        listOf(50, 150 ,200),\n",
    "        listOf(200,100,50)\n",
    "    )\n",
    ")\n",
    "\n",
    "ggplot() + geomImshow(A2x3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Grayscale image without normalization"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:04:17.174441Z",
     "iopub.status.busy": "2025-12-03T16:04:17.174003Z",
     "iopub.status.idle": "2025-12-03T16:04:17.220664Z",
     "shell.execute_reply": "2025-12-03T16:04:17.220362Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "kind": "plot",
        "layers": [
         {
          "color_by": "paint_c",
          "geom": "image",
          "href": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAAAAAC4HznGAAAAEElEQVR42mMwmnaC4USKEQAMJALvl3jyVQAAAABJRU5ErkJggg==",
          "inherit_aes": false,
          "mapping": {
           "paint_c": [
            50.0,
            200.0
           ]
          },
          "stat": "identity",
          "xmax": 2.5,
          "xmin": -0.5,
          "ymax": 1.5,
          "ymin": -0.5
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "paint_c",
          "end": 0.7843137254901961,
          "name": "",
          "scale_mapper_kind": "color_grey",
          "start": 0.19607843137254902
         }
        ]
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"cT7iI1\" ></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(\"cT7iI1\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"paint_c\",\n",
       "\"scale_mapper_kind\":\"color_grey\",\n",
       "\"name\":\"\",\n",
       "\"start\":0.19607843137254902,\n",
       "\"end\":0.7843137254901961\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "\"paint_c\":\"paint_c\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":1.5,\n",
       "\"xmax\":2.5,\n",
       "\"color_by\":\"paint_c\",\n",
       "\"inherit_aes\":false,\n",
       "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAAAAAC4HznGAAAAEElEQVR42mMwmnaC4USKEQAMJALvl3jyVQAAAABJRU5ErkJggg==\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "\"paint_c\":[50.0,200.0]\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=edb71b9f-da3f-46e7-882b-97900fb17767 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",
       "#p9zJee3 .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",
       "#p9zJee3 .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",
       "#p9zJee3 .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",
       "#p9zJee3 .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#p9zJee3 .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",
       "#p9zJee3 .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",
       "#p9zJee3 .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",
       "#p9zJee3 .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",
       "#dYZupVp .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",
       "#p9zJee3 .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",
       "#p9zJee3 .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",
       "#dYZupVp .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",
       "#p9zJee3 .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",
       "#p9zJee3 .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",
       "#dYZupVp .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",
       "#dYZupVp .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",
       "#dYZupVp .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=\"p9zJee3\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 16.64914192329607 L0.0 383.35085807670396 L600.0 383.35085807670396 L600.0 16.64914192329607 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(21.0 22.64914192329607 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"21.866026101368718\" y1=\"0.0\" x2=\"21.866026101368718\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"94.75277977259776\" y1=\"0.0\" x2=\"94.75277977259776\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"167.6395334438268\" y1=\"0.0\" x2=\"167.6395334438268\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"240.52628711505585\" y1=\"0.0\" x2=\"240.52628711505585\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"313.4130407862849\" y1=\"0.0\" x2=\"313.4130407862849\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"386.29979445751394\" y1=\"0.0\" x2=\"386.29979445751394\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"459.18654812874297\" y1=\"0.0\" x2=\"459.18654812874297\" y2=\"320.70171615340786\" 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=\"306.124365419162\" x2=\"481.0525742301117\" y2=\"306.124365419162\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"233.237611747933\" x2=\"481.0525742301117\" y2=\"233.237611747933\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"160.35085807670393\" x2=\"481.0525742301117\" y2=\"160.35085807670393\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"87.46410440547487\" x2=\"481.0525742301117\" y2=\"87.46410440547487\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"14.577350734245812\" x2=\"481.0525742301117\" y2=\"14.577350734245812\" 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(#c95zQkL)\" clip-bounds-jfx=\"[rect (31.015306675749617, 0.0), (481.0525742301117, 320.70171615340786)]\">\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <image preserveAspectRatio=\"none\" x=\"21.866026101368718\" y=\"14.577350734245812\" width=\"437.32052202737424\" height=\"291.54701468491623\" xlink:href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAAAAAC4HznGAAAAEElEQVR42mMwmnaC4USKEQAMJALvl3jyVQAAAABJRU5ErkJggg==\" style=\"image-rendering: optimizeSpeed; image-rendering: pixelated\">\n",
       "              </image>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"c95zQkL\">\n",
       "            <rect x=\"31.015306675749617\" y=\"0.0\" width=\"481.0525742301117\" height=\"320.70171615340786\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 320.70171615340786 ) \">\n",
       "          <g transform=\"translate(21.866026101368718 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(94.75277977259776 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(167.6395334438268 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(240.52628711505585 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(313.4130407862849 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(386.29979445751394 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(459.18654812874297 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=\"481.0525742301117\" 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 306.124365419162 ) \">\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 233.237611747933 ) \">\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 160.35085807670393 ) \">\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 87.46410440547487 ) \">\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 14.577350734245812 ) \">\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>\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(292.54159379080545 377.35085807670396 ) \">\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(536.0678809058613 120.5 ) \">\n",
       "      <rect x=\"0.0\" y=\"0.0\" height=\"125.0\" width=\"60.932119094138706\" 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=\"\">\n",
       "          <g>\n",
       "            <rect x=\"0.0\" y=\"0.0\" height=\"115.0\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(190,190,190)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"7.55\" height=\"107.45\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(182,182,182)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"13.1\" height=\"101.9\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(174,174,174)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"18.65\" height=\"96.35\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(166,166,166)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"24.2\" height=\"90.8\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(158,158,158)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"29.75\" height=\"85.25\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(150,150,150)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"35.3\" height=\"79.7\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(143,143,143)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"40.849999999999994\" height=\"74.15\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(135,135,135)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"46.39999999999999\" height=\"68.60000000000001\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(128,128,128)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"51.94999999999999\" height=\"63.05000000000001\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(120,120,120)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"57.499999999999986\" height=\"57.500000000000014\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(113,113,113)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"63.04999999999998\" height=\"51.95000000000002\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(105,105,105)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"68.59999999999998\" height=\"46.40000000000002\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(98,98,98)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"74.14999999999998\" height=\"40.85000000000002\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(91,91,91)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"79.69999999999997\" height=\"35.300000000000026\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(84,84,84)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"85.24999999999997\" height=\"29.75000000000003\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(77,77,77)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"90.79999999999997\" height=\"24.20000000000003\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(70,70,70)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"96.34999999999997\" height=\"18.650000000000034\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(64,64,64)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"101.89999999999996\" height=\"13.100000000000037\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(57,57,57)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"107.44999999999996\" height=\"7.55000000000004\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(51,51,51)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <line x1=\"0.0\" y1=\"113.0\" x2=\"4.0\" y2=\"113.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"113.0\" x2=\"23.0\" y2=\"113.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 117.55 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>50</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "            <line x1=\"0.0\" y1=\"76.0\" x2=\"4.0\" y2=\"76.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"76.0\" x2=\"23.0\" y2=\"76.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 80.55 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>100</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "            <line x1=\"0.0\" y1=\"39.0\" x2=\"4.0\" y2=\"39.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"39.0\" x2=\"23.0\" y2=\"39.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 43.55 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>150</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "            <line x1=\"0.0\" y1=\"2.0\" x2=\"4.0\" y2=\"2.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"2.0\" x2=\"23.0\" y2=\"2.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 6.549999999999999 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>200</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 16.64914192329607 L0.0 383.35085807670396 L600.0 383.35085807670396 L600.0 16.64914192329607 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dYZupVp\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"edb71b9f-da3f-46e7-882b-97900fb17767\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ggplot() + geomImshow(A2x3, norm=false)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### RGB image\n",
    "\n",
    "M x N x 3 array"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:04:17.222782Z",
     "iopub.status.busy": "2025-12-03T16:04:17.222296Z",
     "iopub.status.idle": "2025-12-03T16:04:17.302639Z",
     "shell.execute_reply": "2025-12-03T16:04:17.302713Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "kind": "plot",
        "layers": [
         {
          "color_by": "paint_c",
          "geom": "image",
          "href": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAIAAAASFvFNAAAAEklEQVR42mP4z8DAAMVgCkgAADvYBftImLKDAAAAAElFTkSuQmCC",
          "inherit_aes": false,
          "mapping": {},
          "stat": "identity",
          "xmax": 2.5,
          "xmin": -0.5,
          "ymax": 1.5,
          "ymin": -0.5
         }
        ],
        "mapping": {},
        "scales": []
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"HQ0rzC\" ></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(\"HQ0rzC\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":1.5,\n",
       "\"xmax\":2.5,\n",
       "\"color_by\":\"paint_c\",\n",
       "\"inherit_aes\":false,\n",
       "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAIAAAASFvFNAAAAEklEQVR42mP4z8DAAMVgCkgAADvYBftImLKDAAAAAElFTkSuQmCC\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\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=c9865c2a-3f4b-49b0-b160-eb6d7e4fba40 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",
       "#pnwKpM2 .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",
       "#pnwKpM2 .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",
       "#pnwKpM2 .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",
       "#pnwKpM2 .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#pnwKpM2 .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",
       "#pnwKpM2 .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",
       "#pnwKpM2 .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",
       "#pnwKpM2 .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",
       "#dILno8Y .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",
       "#pnwKpM2 .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",
       "#pnwKpM2 .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",
       "#dILno8Y .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",
       "#pnwKpM2 .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",
       "#pnwKpM2 .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",
       "#dILno8Y .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",
       "#dILno8Y .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",
       "#dILno8Y .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=\"pnwKpM2\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M5.4923466621252715 0.0 L5.4923466621252715 400.0 L594.5076533378747 400.0 L594.5076533378747 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(26.49234666212527 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"24.13636363636364\" y1=\"0.0\" x2=\"24.13636363636364\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"104.59090909090908\" y1=\"0.0\" x2=\"104.59090909090908\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"185.0454545454545\" y1=\"0.0\" x2=\"185.0454545454545\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"265.49999999999994\" y1=\"0.0\" x2=\"265.49999999999994\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"345.9545454545454\" y1=\"0.0\" x2=\"345.9545454545454\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"426.4090909090908\" y1=\"0.0\" x2=\"426.4090909090908\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"506.86363636363626\" y1=\"0.0\" x2=\"506.86363636363626\" 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=\"337.9090909090909\" x2=\"530.9999999999999\" y2=\"337.9090909090909\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"257.45454545454544\" x2=\"530.9999999999999\" y2=\"257.45454545454544\" 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=\"530.9999999999999\" 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.54545454545453\" x2=\"530.9999999999999\" y2=\"96.54545454545453\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"16.090909090909065\" x2=\"530.9999999999999\" y2=\"16.090909090909065\" 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(#cQ38u8F)\" clip-bounds-jfx=\"[rect (31.015306675749617, 0.0), (530.9999999999999, 354.0)]\">\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <image preserveAspectRatio=\"none\" x=\"24.13636363636364\" y=\"16.090909090909065\" width=\"482.72727272727263\" height=\"321.8181818181818\" xlink:href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAIAAAASFvFNAAAAEklEQVR42mP4z8DAAMVgCkgAADvYBftImLKDAAAAAElFTkSuQmCC\" style=\"image-rendering: optimizeSpeed; image-rendering: pixelated\">\n",
       "              </image>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cQ38u8F\">\n",
       "            <rect x=\"31.015306675749617\" y=\"0.0\" width=\"530.9999999999999\" 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(24.13636363636364 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(104.59090909090908 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(185.0454545454545 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(265.49999999999994 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(345.9545454545454 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(426.4090909090908 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(506.86363636363626 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=\"530.9999999999999\" 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 337.9090909090909 ) \">\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.45454545454544 ) \">\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 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>0.5</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 96.54545454545453 ) \">\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 16.090909090909065 ) \">\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>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(20.49234666212527 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=\"M5.4923466621252715 0.0 L5.4923466621252715 400.0 L594.5076533378747 400.0 L594.5076533378747 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dILno8Y\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"c9865c2a-3f4b-49b0-b160-eb6d7e4fba40\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val A2x3x3 = RasterData.create(\n",
    "    listOf(\n",
    "        listOf(listOf(255, 0, 0), listOf(0, 255, 0), listOf(0, 0, 255)),\n",
    "        listOf(listOf(0, 255, 0), listOf(0, 0, 255), listOf(255, 0, 0))\n",
    "    )\n",
    ")\n",
    "\n",
    "ggplot() + geomImshow(A2x3x3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### RGB image with alpha channel\n",
    "\n",
    "M x N x 4 array"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:04:17.304943Z",
     "iopub.status.busy": "2025-12-03T16:04:17.304264Z",
     "iopub.status.idle": "2025-12-03T16:04:17.383245Z",
     "shell.execute_reply": "2025-12-03T16:04:17.383039Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "kind": "plot",
        "layers": [
         {
          "color_by": "paint_c",
          "geom": "image",
          "href": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVR42mP4z8DwHwwZ/oOZvkDCF8jyBQCLFgnfxsUWGQAAAABJRU5ErkJggg==",
          "inherit_aes": false,
          "mapping": {},
          "stat": "identity",
          "xmax": 2.5,
          "xmin": -0.5,
          "ymax": 1.5,
          "ymin": -0.5
         }
        ],
        "mapping": {},
        "scales": []
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"1bumOo\" ></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(\"1bumOo\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":1.5,\n",
       "\"xmax\":2.5,\n",
       "\"color_by\":\"paint_c\",\n",
       "\"inherit_aes\":false,\n",
       "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVR42mP4z8DwHwwZ/oOZvkDCF8jyBQCLFgnfxsUWGQAAAABJRU5ErkJggg==\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\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=a293247a-e733-418c-bc51-2445215f1463 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",
       "#phNpLTj .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",
       "#phNpLTj .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",
       "#phNpLTj .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",
       "#phNpLTj .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#phNpLTj .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",
       "#phNpLTj .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",
       "#phNpLTj .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",
       "#phNpLTj .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",
       "#dkyuERd .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",
       "#phNpLTj .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",
       "#phNpLTj .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",
       "#dkyuERd .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",
       "#phNpLTj .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",
       "#phNpLTj .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",
       "#dkyuERd .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",
       "#dkyuERd .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",
       "#dkyuERd .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=\"phNpLTj\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M5.4923466621252715 0.0 L5.4923466621252715 400.0 L594.5076533378747 400.0 L594.5076533378747 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(26.49234666212527 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"24.13636363636364\" y1=\"0.0\" x2=\"24.13636363636364\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"104.59090909090908\" y1=\"0.0\" x2=\"104.59090909090908\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"185.0454545454545\" y1=\"0.0\" x2=\"185.0454545454545\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"265.49999999999994\" y1=\"0.0\" x2=\"265.49999999999994\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"345.9545454545454\" y1=\"0.0\" x2=\"345.9545454545454\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"426.4090909090908\" y1=\"0.0\" x2=\"426.4090909090908\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"506.86363636363626\" y1=\"0.0\" x2=\"506.86363636363626\" 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=\"337.9090909090909\" x2=\"530.9999999999999\" y2=\"337.9090909090909\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"257.45454545454544\" x2=\"530.9999999999999\" y2=\"257.45454545454544\" 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=\"530.9999999999999\" 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.54545454545453\" x2=\"530.9999999999999\" y2=\"96.54545454545453\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"16.090909090909065\" x2=\"530.9999999999999\" y2=\"16.090909090909065\" 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(#cPDvlOe)\" clip-bounds-jfx=\"[rect (31.015306675749617, 0.0), (530.9999999999999, 354.0)]\">\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <image preserveAspectRatio=\"none\" x=\"24.13636363636364\" y=\"16.090909090909065\" width=\"482.72727272727263\" height=\"321.8181818181818\" xlink:href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVR42mP4z8DwHwwZ/oOZvkDCF8jyBQCLFgnfxsUWGQAAAABJRU5ErkJggg==\" style=\"image-rendering: optimizeSpeed; image-rendering: pixelated\">\n",
       "              </image>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cPDvlOe\">\n",
       "            <rect x=\"31.015306675749617\" y=\"0.0\" width=\"530.9999999999999\" 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(24.13636363636364 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(104.59090909090908 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(185.0454545454545 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(265.49999999999994 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(345.9545454545454 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(426.4090909090908 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(506.86363636363626 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=\"530.9999999999999\" 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 337.9090909090909 ) \">\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.45454545454544 ) \">\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 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>0.5</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 96.54545454545453 ) \">\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 16.090909090909065 ) \">\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>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(20.49234666212527 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=\"M5.4923466621252715 0.0 L5.4923466621252715 400.0 L594.5076533378747 400.0 L594.5076533378747 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dkyuERd\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"a293247a-e733-418c-bc51-2445215f1463\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val A2x3x4 = RasterData.create(\n",
    "    listOf(\n",
    "        listOf(\n",
    "            listOf(1.0, 0.0, 0.0, 1.0), listOf(0.0, 1.0, 0.0, 1.0), listOf(0.0, 0.0, 1.0, 1.0)\n",
    "        ),\n",
    "        listOf(\n",
    "            listOf(0.0, 1.0, 0.0, 0.3), listOf(0.0, 0.0, 1.0, 0.3), listOf(1.0, 0.0, 0.0, 0.3)\n",
    "        )\n",
    "    )\n",
    ")\n",
    "\n",
    "ggplot() + geomImshow(A2x3x4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Image specified by array"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Grayscale image specified by ByteArray\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:04:17.385242Z",
     "iopub.status.busy": "2025-12-03T16:04:17.384942Z",
     "iopub.status.idle": "2025-12-03T16:04:17.447968Z",
     "shell.execute_reply": "2025-12-03T16:04:17.448090Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "kind": "plot",
        "layers": [
         {
          "color_by": "paint_c",
          "geom": "image",
          "href": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAAAAAC4HznGAAAAEElEQVR42mNgWPWf4X8oAwAMpgL+0LIbjQAAAABJRU5ErkJggg==",
          "inherit_aes": false,
          "mapping": {
           "paint_c": [
            50.0,
            200.0
           ]
          },
          "stat": "identity",
          "xmax": 2.5,
          "xmin": -0.5,
          "ymax": 1.5,
          "ymin": -0.5
         }
        ],
        "mapping": {},
        "scales": [
         {
          "aesthetic": "paint_c",
          "end": 1.0,
          "name": "",
          "scale_mapper_kind": "color_grey",
          "start": 0.0
         }
        ]
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"RverBs\" ></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(\"RverBs\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"paint_c\",\n",
       "\"scale_mapper_kind\":\"color_grey\",\n",
       "\"name\":\"\",\n",
       "\"start\":0.0,\n",
       "\"end\":1.0\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "\"paint_c\":\"paint_c\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":1.5,\n",
       "\"xmax\":2.5,\n",
       "\"color_by\":\"paint_c\",\n",
       "\"inherit_aes\":false,\n",
       "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAAAAAC4HznGAAAAEElEQVR42mNgWPWf4X8oAwAMpgL+0LIbjQAAAABJRU5ErkJggg==\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "\"paint_c\":[50.0,200.0]\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=dc66abac-46f4-4ef5-ab44-4e3e2f3e6d9e 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",
       "#pQ593mC .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",
       "#pQ593mC .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",
       "#pQ593mC .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",
       "#pQ593mC .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#pQ593mC .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",
       "#pQ593mC .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",
       "#pQ593mC .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",
       "#pQ593mC .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",
       "#dkjKJSA .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",
       "#pQ593mC .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",
       "#pQ593mC .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",
       "#dkjKJSA .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",
       "#pQ593mC .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",
       "#pQ593mC .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",
       "#dkjKJSA .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",
       "#dkjKJSA .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",
       "#dkjKJSA .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=\"pQ593mC\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 16.64914192329607 L0.0 383.35085807670396 L600.0 383.35085807670396 L600.0 16.64914192329607 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(21.0 22.64914192329607 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"21.866026101368718\" y1=\"0.0\" x2=\"21.866026101368718\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"94.75277977259776\" y1=\"0.0\" x2=\"94.75277977259776\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"167.6395334438268\" y1=\"0.0\" x2=\"167.6395334438268\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"240.52628711505585\" y1=\"0.0\" x2=\"240.52628711505585\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"313.4130407862849\" y1=\"0.0\" x2=\"313.4130407862849\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"386.29979445751394\" y1=\"0.0\" x2=\"386.29979445751394\" y2=\"320.70171615340786\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"459.18654812874297\" y1=\"0.0\" x2=\"459.18654812874297\" y2=\"320.70171615340786\" 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=\"306.124365419162\" x2=\"481.0525742301117\" y2=\"306.124365419162\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"233.237611747933\" x2=\"481.0525742301117\" y2=\"233.237611747933\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"160.35085807670393\" x2=\"481.0525742301117\" y2=\"160.35085807670393\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"87.46410440547487\" x2=\"481.0525742301117\" y2=\"87.46410440547487\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"14.577350734245812\" x2=\"481.0525742301117\" y2=\"14.577350734245812\" 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(#ccTWhVY)\" clip-bounds-jfx=\"[rect (31.015306675749617, 0.0), (481.0525742301117, 320.70171615340786)]\">\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <image preserveAspectRatio=\"none\" x=\"21.866026101368718\" y=\"14.577350734245812\" width=\"437.32052202737424\" height=\"291.54701468491623\" xlink:href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAAAAAC4HznGAAAAEElEQVR42mNgWPWf4X8oAwAMpgL+0LIbjQAAAABJRU5ErkJggg==\" style=\"image-rendering: optimizeSpeed; image-rendering: pixelated\">\n",
       "              </image>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"ccTWhVY\">\n",
       "            <rect x=\"31.015306675749617\" y=\"0.0\" width=\"481.0525742301117\" height=\"320.70171615340786\">\n",
       "            </rect>\n",
       "          </clipPath>\n",
       "        </defs>\n",
       "      </g>\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 320.70171615340786 ) \">\n",
       "          <g transform=\"translate(21.866026101368718 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(94.75277977259776 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(167.6395334438268 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(240.52628711505585 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(313.4130407862849 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(386.29979445751394 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(459.18654812874297 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=\"481.0525742301117\" 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 306.124365419162 ) \">\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 233.237611747933 ) \">\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 160.35085807670393 ) \">\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 87.46410440547487 ) \">\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 14.577350734245812 ) \">\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>\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(292.54159379080545 377.35085807670396 ) \">\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(536.0678809058613 120.5 ) \">\n",
       "      <rect x=\"0.0\" y=\"0.0\" height=\"125.0\" width=\"60.932119094138706\" 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=\"\">\n",
       "          <g>\n",
       "            <rect x=\"0.0\" y=\"0.0\" height=\"115.0\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(248,248,248)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"7.55\" height=\"107.45\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(233,233,233)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"13.1\" height=\"101.9\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(219,219,219)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"18.65\" height=\"96.35\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(205,205,205)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"24.2\" height=\"90.8\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(191,191,191)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"29.75\" height=\"85.25\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(178,178,178)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"35.3\" height=\"79.7\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(164,164,164)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"40.849999999999994\" height=\"74.15\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(151,151,151)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"46.39999999999999\" height=\"68.60000000000001\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(138,138,138)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"51.94999999999999\" height=\"63.05000000000001\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(125,125,125)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"57.499999999999986\" height=\"57.500000000000014\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(113,113,113)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"63.04999999999998\" height=\"51.95000000000002\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(100,100,100)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"68.59999999999998\" height=\"46.40000000000002\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(88,88,88)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"74.14999999999998\" height=\"40.85000000000002\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(76,76,76)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"79.69999999999997\" height=\"35.300000000000026\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(65,65,65)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"85.24999999999997\" height=\"29.75000000000003\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(54,54,54)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"90.79999999999997\" height=\"24.20000000000003\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(43,43,43)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"96.34999999999997\" height=\"18.650000000000034\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(33,33,33)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"101.89999999999996\" height=\"13.100000000000037\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(23,23,23)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <rect x=\"0.0\" y=\"107.44999999999996\" height=\"7.55000000000004\" width=\"23.0\" stroke-width=\"0.0\" fill=\"rgb(9,9,9)\" fill-opacity=\"1.0\">\n",
       "            </rect>\n",
       "            <line x1=\"0.0\" y1=\"113.0\" x2=\"4.0\" y2=\"113.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"113.0\" x2=\"23.0\" y2=\"113.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 117.55 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>50</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "            <line x1=\"0.0\" y1=\"76.0\" x2=\"4.0\" y2=\"76.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"76.0\" x2=\"23.0\" y2=\"76.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 80.55 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>100</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "            <line x1=\"0.0\" y1=\"39.0\" x2=\"4.0\" y2=\"39.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"39.0\" x2=\"23.0\" y2=\"39.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 43.55 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>150</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "            <line x1=\"0.0\" y1=\"2.0\" x2=\"4.0\" y2=\"2.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <line x1=\"19.0\" y1=\"2.0\" x2=\"23.0\" y2=\"2.0\" stroke-width=\"1.0\" stroke=\"rgb(255,255,255)\" stroke-opacity=\"1.0\">\n",
       "            </line>\n",
       "            <g transform=\"translate(26.9903027277341 6.549999999999999 ) \">\n",
       "              <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"legend-item\">\n",
       "                <tspan>200</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 16.64914192329607 L0.0 383.35085807670396 L600.0 383.35085807670396 L600.0 16.64914192329607 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dkjKJSA\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"dc66abac-46f4-4ef5-ab44-4e3e2f3e6d9e\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val byteArrayA2x3 = RasterData.create(\n",
    "    byteArrayOf(50, 150.toByte(), 200.toByte(), 200.toByte(), 100, 50),\n",
    "    width = 3, height = 2, nChannels = 1\n",
    ")\n",
    "\n",
    "ggplot() + geomImshow(byteArrayA2x3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### RGB image with alpha channel specified by IntArray\n",
    "Note that pixels are not packed - size of the array have to be equal to `width * height * nChannels`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-12-03T16:04:17.450237Z",
     "iopub.status.busy": "2025-12-03T16:04:17.450028Z",
     "iopub.status.idle": "2025-12-03T16:04:17.508513Z",
     "shell.execute_reply": "2025-12-03T16:04:17.508258Z"
    }
   },
   "outputs": [
    {
     "data": {
      "application/plot+json": {
       "apply_color_scheme": true,
       "output": {
        "kind": "plot",
        "layers": [
         {
          "color_by": "paint_c",
          "geom": "image",
          "href": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVR42mP4z8DwHwwZ/oOZAUAiAMgKAACLQwno6mpeHAAAAABJRU5ErkJggg==",
          "inherit_aes": false,
          "mapping": {},
          "stat": "identity",
          "xmax": 2.5,
          "xmin": -0.5,
          "ymax": 1.5,
          "ymin": -0.5
         }
        ],
        "mapping": {},
        "scales": []
       },
       "output_type": "lets_plot_spec",
       "swing_enabled": true
      },
      "text/html": [
       "   <div id=\"YSMaqp\" ></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(\"YSMaqp\");\n",
       "   let fig = null;\n",
       "   \n",
       "   function renderPlot() {\n",
       "       if (fig === null) {\n",
       "           const plotSpec = {\n",
       "\"mapping\":{\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":1.5,\n",
       "\"xmax\":2.5,\n",
       "\"color_by\":\"paint_c\",\n",
       "\"inherit_aes\":false,\n",
       "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVR42mP4z8DwHwwZ/oOZAUAiAMgKAACLQwno6mpeHAAAAABJRU5ErkJggg==\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\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=79634b36-e6ec-4491-9669-c0a05f8dcb79 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",
       "#pksDsSJ .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",
       "#pksDsSJ .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",
       "#pksDsSJ .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",
       "#pksDsSJ .hyperlink-element {\n",
       "fill: #118ed8;\n",
       "font-weight: normal;\n",
       "font-style: normal;\n",
       "\n",
       "}\n",
       "#pksDsSJ .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",
       "#pksDsSJ .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",
       "#pksDsSJ .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",
       "#pksDsSJ .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",
       "#dr1fVMm .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",
       "#pksDsSJ .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",
       "#pksDsSJ .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",
       "#dr1fVMm .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",
       "#pksDsSJ .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",
       "#pksDsSJ .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",
       "#dr1fVMm .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",
       "#dr1fVMm .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",
       "#dr1fVMm .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=\"pksDsSJ\">\n",
       "    <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M5.4923466621252715 0.0 L5.4923466621252715 400.0 L594.5076533378747 400.0 L594.5076533378747 0.0 Z\">\n",
       "    </path>\n",
       "    <g transform=\"translate(26.49234666212527 6.0 ) \">\n",
       "      <g>\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <line x1=\"24.13636363636364\" y1=\"0.0\" x2=\"24.13636363636364\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"104.59090909090908\" y1=\"0.0\" x2=\"104.59090909090908\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"185.0454545454545\" y1=\"0.0\" x2=\"185.0454545454545\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"265.49999999999994\" y1=\"0.0\" x2=\"265.49999999999994\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"345.9545454545454\" y1=\"0.0\" x2=\"345.9545454545454\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"426.4090909090908\" y1=\"0.0\" x2=\"426.4090909090908\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"506.86363636363626\" y1=\"0.0\" x2=\"506.86363636363626\" 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=\"337.9090909090909\" x2=\"530.9999999999999\" y2=\"337.9090909090909\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"257.45454545454544\" x2=\"530.9999999999999\" y2=\"257.45454545454544\" 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=\"530.9999999999999\" 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.54545454545453\" x2=\"530.9999999999999\" y2=\"96.54545454545453\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
       "            </line>\n",
       "            <line x1=\"0.0\" y1=\"16.090909090909065\" x2=\"530.9999999999999\" y2=\"16.090909090909065\" 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(#cGr6Tdn)\" clip-bounds-jfx=\"[rect (31.015306675749617, 0.0), (530.9999999999999, 354.0)]\">\n",
       "        <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
       "          <g>\n",
       "            <g>\n",
       "              <image preserveAspectRatio=\"none\" x=\"24.13636363636364\" y=\"16.090909090909065\" width=\"482.72727272727263\" height=\"321.8181818181818\" xlink:href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVR42mP4z8DwHwwZ/oOZAUAiAMgKAACLQwno6mpeHAAAAABJRU5ErkJggg==\" style=\"image-rendering: optimizeSpeed; image-rendering: pixelated\">\n",
       "              </image>\n",
       "            </g>\n",
       "          </g>\n",
       "        </g>\n",
       "        <defs>\n",
       "          <clipPath id=\"cGr6Tdn\">\n",
       "            <rect x=\"31.015306675749617\" y=\"0.0\" width=\"530.9999999999999\" 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(24.13636363636364 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(104.59090909090908 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(185.0454545454545 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(265.49999999999994 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(345.9545454545454 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(426.4090909090908 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(506.86363636363626 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=\"530.9999999999999\" 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 337.9090909090909 ) \">\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.45454545454544 ) \">\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 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>0.5</tspan>\n",
       "              </text>\n",
       "            </g>\n",
       "          </g>\n",
       "          <g transform=\"translate(0.0 96.54545454545453 ) \">\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 16.090909090909065 ) \">\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>\n",
       "      </g>\n",
       "    </g>\n",
       "    <g transform=\"translate(20.49234666212527 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=\"M5.4923466621252715 0.0 L5.4923466621252715 400.0 L594.5076533378747 400.0 L594.5076533378747 0.0 Z\" pointer-events=\"none\">\n",
       "    </path>\n",
       "  </g>\n",
       "  <g id=\"dr1fVMm\">\n",
       "  </g>\n",
       "</svg>\n",
       "                <script>document.getElementById(\"79634b36-e6ec-4491-9669-c0a05f8dcb79\").style.display = \"none\";</script>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val intArrayA2x3x4 = RasterData.create(\n",
    "    listOf(\n",
    "            255, 0, 0, 255, \n",
    "            0, 255, 0, 255, \n",
    "            0, 0, 255, 255,\n",
    "            0, 255, 0, 80, \n",
    "            0, 0, 255, 80, \n",
    "            255, 0, 0, 80\n",
    "        ).toIntArray(),\n",
    "    width = 3, height = 2, nChannels = 4\n",
    ")\n",
    "\n",
    "ggplot() + geomImshow(intArrayA2x3x4)"
   ]
  }
 ],
 "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": 4
}
