source/kotlin_examples/cookbook/image_grayscale.ipynb (1,934 lines of code) (raw):

{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Using parameters `norm`, `vmain`, `vmax` in `geomImshow()`\n", "\n", "You can use parameters `norm`, `vmain`, `vmax` when rendering grayscale images.\n", "\n", "A grayscale image is specified by 2D array where each element's value \n", "represents the luminance of corresponding pixel in the image." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2025-12-03T16:08:13.000999Z", "iopub.status.busy": "2025-12-03T16:08:12.999448Z", "iopub.status.idle": "2025-12-03T16:08:14.917985Z", "shell.execute_reply": "2025-12-03T16:08:14.917747Z" } }, "outputs": [ { "data": { "text/html": [ " <div id=\"H0Lz1z\"></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(\"H0Lz1z\").appendChild(div);\n", " };\n", " var e = document.getElementById(\"H0Lz1z\");\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:08:14.919811Z", "iopub.status.busy": "2025-12-03T16:08:14.919621Z", "iopub.status.idle": "2025-12-03T16:08:14.957103Z", "shell.execute_reply": "2025-12-03T16:08:14.957222Z" } }, "outputs": [ { "data": { "text/plain": [ "Lets-Plot Kotlin API v.4.12.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.8.1.\n", "Outputs: Web (HTML+JS), Kotlin Notebook (Swing), Static SVG (hidden)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LetsPlot.getInfo()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2025-12-03T16:08:14.958693Z", "iopub.status.busy": "2025-12-03T16:08:14.958450Z", "iopub.status.idle": "2025-12-03T16:08:15.205242Z", "shell.execute_reply": "2025-12-03T16:08:15.205064Z" } }, "outputs": [], "source": [ "// Generate 2D arrays. \n", "// First two arrays both contain float numbers but have different range of values.\n", "// The 3rd array contains int-s.\n", "fun linspace(start: Double, end: Double, count: Int): List<Number> {\n", " val step = (end - start) / (count - 1)\n", " return mutableListOf<Double>() + \n", " start + (1 .. (count - 2)).map { i -> start + i * step } + end\n", "}\n", "\n", "val arr_f0 = RasterData.create(listOf(linspace(0.3, 0.7, 30)))\n", "val arr_f1 = RasterData.create(listOf(linspace(30.0, 170.0, 30)))\n", "val arr_i = RasterData.create(listOf(linspace(30.0, 170.0, 30).map { it.toInt() }))" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2025-12-03T16:08:15.206603Z", "iopub.status.busy": "2025-12-03T16:08:15.206412Z", "iopub.status.idle": "2025-12-03T16:08:15.292433Z", "shell.execute_reply": "2025-12-03T16:08:15.292255Z" } }, "outputs": [], "source": [ "// Setup suitable plot options for the demo.\n", "val p = (letsPlot() + ggsize(450, 60) + geomRect(xmin=-0.5, ymin=-0.5, xmax=29.5, ymax=0.5, color=\"black\", alpha=0) + \n", "coordCartesian() + themeClassic() + theme(axis=\"blank\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Image normalization\n", "\n", "By default, `geomImshow()` applies a linear scaling to transform data values to range [0-255]." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2025-12-03T16:08:15.294767Z", "iopub.status.busy": "2025-12-03T16:08:15.294321Z", "iopub.status.idle": "2025-12-03T16:08:15.417650Z", "shell.execute_reply": "2025-12-03T16:08:15.417303Z" } }, "outputs": [ { "data": { "text/html": [ " <div id=\"vw30Ae\" ></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(\"vw30Ae\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\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", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAKElEQVR42mNg4BSSUtYxtXPzj0jMKqpu6Z06b/mGnQdPXb7z9O23/wCakQ7ytzjzsgAAAABJRU5ErkJggg==\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[0.30000001192092896,0.699999988079071]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\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>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " <div id=\"4qDapK\" ></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(\"4qDapK\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\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", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAKElEQVR42mNg4BSSUtYxtXPzj0jMKqpu6Z06b/mGnQdPXb7z9O23/wCakQ7ytzjzsgAAAABJRU5ErkJggg==\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[30.0,170.0]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\n", "},\n", "\"spec_id\":\"2\"\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>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " <div id=\"vleclt\" ></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(\"vleclt\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\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", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAKElEQVR42mNgYBeQUtYxtnH1C0/MKKxq7pk6d9n6HQdPXbz95O23/wCY4Q7ZZG8/XQAAAABJRU5ErkJggg==\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[30.0,170.0]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\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>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "(p + geomImshow(arr_f0)).show()\n", "(p + geomImshow(arr_f1)).show()\n", "(p + geomImshow(arr_i)).show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## \n", "\n", "You can disable image normalization using the `norm` parameter." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2025-12-03T16:08:15.419343Z", "iopub.status.busy": "2025-12-03T16:08:15.419187Z", "iopub.status.idle": "2025-12-03T16:08:15.456881Z", "shell.execute_reply": "2025-12-03T16:08:15.456719Z" } }, "outputs": [ { "data": { "text/html": [ " <div id=\"ubqOJK\" ></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(\"ubqOJK\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[{\n", "\"aesthetic\":\"paint_c\",\n", "\"scale_mapper_kind\":\"color_grey\",\n", "\"name\":\"\",\n", "\"start\":0.0011764706349840352,\n", "\"end\":0.002745097992466945\n", "}],\n", "\"layers\":[{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAADklEQVR42mNgQAWMqAAAAJcAEIuvA1AAAAAASUVORK5CYII=\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[0.30000001192092896,0.699999988079071]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\n", "},\n", "\"spec_id\":\"4\"\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>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " <div id=\"Pj5UXM\" ></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(\"Pj5UXM\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[{\n", "\"aesthetic\":\"paint_c\",\n", "\"scale_mapper_kind\":\"color_grey\",\n", "\"name\":\"\",\n", "\"start\":0.11764705882352941,\n", "\"end\":0.6666666666666666\n", "}],\n", "\"layers\":[{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAJ0lEQVR42mOQU9bQMTSzdnD19AuOiE1Kyy4orapv7uidNH3OgqWrAItcC7nFYjC3AAAAAElFTkSuQmCC\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[30.0,170.0]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\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>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " <div id=\"mL4m6i\" ></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(\"mL4m6i\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\n", "},\n", "\"kind\":\"plot\",\n", "\"scales\":[{\n", "\"aesthetic\":\"paint_c\",\n", "\"scale_mapper_kind\":\"color_grey\",\n", "\"name\":\"\",\n", "\"start\":0.11764705882352941,\n", "\"end\":0.6666666666666666\n", "}],\n", "\"layers\":[{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAJ0lEQVR42mOQU1LXMTSzsnfx9AsOj0lMyy4oqaxr7uidOG32gqWrAIp7C6t9oRO2AAAAAElFTkSuQmCC\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[30.0,170.0]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\n", "},\n", "\"spec_id\":\"6\"\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>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "(p + geomImshow(arr_f0, norm=false)).show()\n", "(p + geomImshow(arr_f1, norm=false)).show()\n", "(p + geomImshow(arr_i, norm=false)).show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Define normalization range using `vmin, vmax` parameters" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2025-12-03T16:08:15.457896Z", "iopub.status.busy": "2025-12-03T16:08:15.457715Z", "iopub.status.idle": "2025-12-03T16:08:15.496409Z", "shell.execute_reply": "2025-12-03T16:08:15.496065Z" } }, "outputs": [ { "data": { "text/html": [ " <div id=\"nP9wHW\" ></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(\"nP9wHW\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\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", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAG0lEQVR42mNgEFI2dYvIqu6dt+Hg5aff/qMCAApuFikt5wgEAAAAAElFTkSuQmCC\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[0.30000001192092896,0.5]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\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>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " <div id=\"4GBpcS\" ></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(\"4GBpcS\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\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", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAG0lEQVR42mNgEFI2dYvIqu6dt+Hg5aff/qMCAApuFikt5wgEAAAAAElFTkSuQmCC\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[30.0,100.0]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\n", "},\n", "\"spec_id\":\"8\"\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>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " <div id=\"IRDLjM\" ></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(\"IRDLjM\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\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", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAG0lEQVR42mNg4Fc0dg1Pq+iau/7ghUdf/qMCAAfdFgzh47X7AAAAAElFTkSuQmCC\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[30.0,100.0]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\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>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "// Set upper limit less than the data max value.\n", "(p + geomImshow(arr_f0, vmax=.5)).show()\n", "(p + geomImshow(arr_f1, vmax=100)).show()\n", "(p + geomImshow(arr_i, vmax=100)).show()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "execution": { "iopub.execute_input": "2025-12-03T16:08:15.498145Z", "iopub.status.busy": "2025-12-03T16:08:15.497718Z", "iopub.status.idle": "2025-12-03T16:08:15.537849Z", "shell.execute_reply": "2025-12-03T16:08:15.537514Z" } }, "outputs": [ { "data": { "text/html": [ " <div id=\"NhbyxH\" ></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(\"NhbyxH\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\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", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAHUlEQVR42mNggAJeeQOnkNTyjlmr955/8Ok/FAAAgG0O8gNOMkEAAAAASUVORK5CYII=\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[0.4000000059604645,0.6000000238418579]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\n", "},\n", "\"spec_id\":\"10\"\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>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " <div id=\"wXPrcH\" ></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(\"wXPrcH\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\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", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAGElEQVR42mNggAEhLefokt6l+66//48AAIywD/oiURHqAAAAAElFTkSuQmCC\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[70.0,120.0]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\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>" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " <div id=\"rsAHjR\" ></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(\"rsAHjR\");\n", " let fig = null;\n", " \n", " function renderPlot() {\n", " if (fig === null) {\n", " const plotSpec = {\n", "\"mapping\":{\n", "},\n", "\"coord\":{\n", "\"name\":\"cartesian\",\n", "\"flip\":false\n", "},\n", "\"ggsize\":{\n", "\"width\":450.0,\n", "\"height\":60.0\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", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color\":\"black\",\n", "\"alpha\":0.0,\n", "\"position\":\"identity\",\n", "\"geom\":\"rect\",\n", "\"data\":{\n", "}\n", "},{\n", "\"ymin\":-0.5,\n", "\"mapping\":{\n", "\"paint_c\":\"paint_c\"\n", "},\n", "\"stat\":\"identity\",\n", "\"xmin\":-0.5,\n", "\"ymax\":0.5,\n", "\"xmax\":29.5,\n", "\"color_by\":\"paint_c\",\n", "\"inherit_aes\":false,\n", "\"href\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAABCAAAAADs20EwAAAAI0lEQVR42mNgAAEuEUU9a/eQuOyK1onzVmw9dP72i0//QQAAh8gO1/cSSuAAAAAASUVORK5CYII=\",\n", "\"geom\":\"image\",\n", "\"data\":{\n", "\"paint_c\":[50.0,150.0]\n", "}\n", "}],\n", "\"theme\":{\n", "\"name\":\"classic\",\n", "\"axis\":\"blank\"\n", "},\n", "\"spec_id\":\"12\"\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>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "// Set limits wider than the data entire range.\n", "(p + geomImshow(arr_f0, vmin=.4, vmax=.6)).show()\n", "(p + geomImshow(arr_f1, vmin=70, vmax=120)).show()\n", "(p + geomImshow(arr_i, vmin=50, vmax=150)).show()" ] } ], "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 }