source/kotlin_examples/cookbook/position_nudge_unit.ipynb (2,051 lines of code) (raw):
{
"cells": [
{
"cell_type": "markdown",
"id": "bbba8dfc-38a5-4bb0-be7c-011843f0ae95",
"metadata": {},
"source": [
"# Configuring Nudge Units in Position Adjustments\n",
"\n",
"The position adjustment `positionNudge()` now supports the `unit` parameter that specifies the measurement system for nudge offsets. <br/>\n",
"Equivalent parameter is also available as `nudgeUnit` in `geomText()` and `geomLabel()` directly. \n",
"\n",
"Available Units:\n",
"\n",
"- `\"identity\"` (default): nudge in data coordinates - a value of 1 corresponds to the distance from 0 to 1 on the axis\n",
"- `\"size\"`: nudge relative to point size - a value of 1 corresponds to the diameter of a point with size 1\n",
"- `\"px\"`: nudge in fixed pixels - a value of 1 corresponds to 1 pixel"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "9b462fcf-68da-4abd-aacf-595979a62133",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-03T15:57:44.381719Z",
"iopub.status.busy": "2025-12-03T15:57:44.379018Z",
"iopub.status.idle": "2025-12-03T15:57:46.331460Z",
"shell.execute_reply": "2025-12-03T15:57:46.331178Z"
}
},
"outputs": [
{
"data": {
"text/html": [
" <div id=\"tp5XA9\"></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(\"tp5XA9\").appendChild(div);\n",
" };\n",
" var e = document.getElementById(\"tp5XA9\");\n",
" e.appendChild(script);\n",
" })();\n",
" </script>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" <div id=\"kotlin_out_0\"></div>\n",
" <script type=\"text/javascript\">\n",
" if(!window.kotlinQueues) {\n",
" window.kotlinQueues = {};\n",
" }\n",
" if(!window.kotlinQueues[\"letsPlotJs\"]) {\n",
" var resQueue = [];\n",
" window.kotlinQueues[\"letsPlotJs\"] = resQueue;\n",
" window[\"call_letsPlotJs\"] = function(f) {\n",
" resQueue.push(f);\n",
" }\n",
" }\n",
" (function (){\n",
" var modifiers = [(function(script) {\n",
" script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.8.1/js-package/distr/lets-plot.min.js\"\n",
" script.type = \"text/javascript\";\n",
"})];\n",
" var e = document.getElementById(\"kotlin_out_0\");\n",
" modifiers.forEach(function (gen) {\n",
" var script = document.createElement(\"script\");\n",
" gen(script)\n",
" script.addEventListener(\"load\", function() {\n",
" window[\"call_letsPlotJs\"] = function(f) {f();};\n",
" window.kotlinQueues[\"letsPlotJs\"].forEach(function(f) {f();});\n",
" window.kotlinQueues[\"letsPlotJs\"] = [];\n",
" }, false);\n",
" script.addEventListener(\"error\", function() {\n",
" window[\"call_letsPlotJs\"] = function(f) {};\n",
" window.kotlinQueues[\"letsPlotJs\"] = [];\n",
" var div = document.createElement(\"div\");\n",
" div.style.color = 'darkred';\n",
" div.textContent = 'Error loading resource letsPlotJs';\n",
" document.getElementById(\"kotlin_out_0\").appendChild(div);\n",
" }, false);\n",
" \n",
" e.appendChild(script);\n",
" });\n",
" })();\n",
" </script>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%useLatestDescriptors\n",
"%use lets-plot"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "ecabca69-383a-46d8-afb0-01d42d0a408e",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-03T15:57:46.334189Z",
"iopub.status.busy": "2025-12-03T15:57:46.333704Z",
"iopub.status.idle": "2025-12-03T15:57:46.368578Z",
"shell.execute_reply": "2025-12-03T15:57:46.367997Z"
}
},
"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",
"id": "3ceb8835-e571-4aac-94c6-310f2011a5a8",
"metadata": {},
"source": [
"#### 1. Without nudge"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "ea4c9641-75e2-463d-bd12-560d3bb96af8",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-03T15:57:46.370950Z",
"iopub.status.busy": "2025-12-03T15:57:46.370497Z",
"iopub.status.idle": "2025-12-03T15:57:46.610022Z",
"shell.execute_reply": "2025-12-03T15:57:46.610143Z"
}
},
"outputs": [
{
"data": {
"text/html": [
" <div id=\"EzSEvK\"></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(\"EzSEvK\").appendChild(div);\n",
" };\n",
" var e = document.getElementById(\"EzSEvK\");\n",
" e.appendChild(script);\n",
" })();\n",
" </script>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/plot+json": {
"apply_color_scheme": true,
"output": {
"ggsize": {
"height": 300.0,
"width": 400.0
},
"kind": "plot",
"layers": [
{
"color": "#DA8459",
"geom": "point",
"mapping": {},
"position": "identity",
"size": 10.0,
"stat": "identity",
"x": 0.0,
"y": 0.0
},
{
"geom": "text",
"label": "text without nudge",
"mapping": {},
"position": "identity",
"stat": "identity",
"x": 0.0,
"y": 0.0
}
],
"mapping": {},
"scales": []
},
"output_type": "lets_plot_spec",
"swing_enabled": true
},
"text/html": [
" <div id=\"IylURS\" ></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(\"IylURS\");\n",
" let fig = null;\n",
" \n",
" function renderPlot() {\n",
" if (fig === null) {\n",
" const plotSpec = {\n",
"\"mapping\":{\n",
"},\n",
"\"ggsize\":{\n",
"\"width\":400.0,\n",
"\"height\":300.0\n",
"},\n",
"\"kind\":\"plot\",\n",
"\"scales\":[],\n",
"\"layers\":[{\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"color\":\"#DA8459\",\n",
"\"size\":10.0,\n",
"\"x\":0.0,\n",
"\"y\":0.0,\n",
"\"position\":\"identity\",\n",
"\"geom\":\"point\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"x\":0.0,\n",
"\"y\":0.0,\n",
"\"position\":\"identity\",\n",
"\"label\":\"text without nudge\",\n",
"\"geom\":\"text\",\n",
"\"data\":{\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=366a6fe1-b47d-46f3-ba63-69cb4d5c06e4 width=\"100%\" height=\"100%\" style=\"max-width: 400.0px; max-height: 300.0px;\" viewBox=\"0 0 400.0 300.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",
"#pZhdHZz .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",
"#pZhdHZz .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",
"#pZhdHZz .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",
"#pZhdHZz .hyperlink-element {\n",
"fill: #118ed8;\n",
"font-weight: normal;\n",
"font-style: normal;\n",
"\n",
"}\n",
"#pZhdHZz .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",
"#pZhdHZz .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",
"#pZhdHZz .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",
"#pZhdHZz .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",
"#doXqAJk .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",
"#pZhdHZz .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",
"#pZhdHZz .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",
"#doXqAJk .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",
"#pZhdHZz .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",
"#pZhdHZz .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",
"#doXqAJk .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",
"#doXqAJk .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",
"#doXqAJk .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=\"pZhdHZz\">\n",
" <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 300.0 L400.0 300.0 L400.0 0.0 Z\">\n",
" </path>\n",
" <g transform=\"translate(21.0 6.0 ) \">\n",
" <g>\n",
" <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
" <g>\n",
" <line x1=\"34.19846933242502\" y1=\"0.0\" x2=\"34.19846933242502\" y2=\"254.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"102.5954079972751\" y1=\"0.0\" x2=\"102.5954079972751\" y2=\"254.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"170.9923466621252\" y1=\"0.0\" x2=\"170.9923466621252\" y2=\"254.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"239.38928532697525\" y1=\"0.0\" x2=\"239.38928532697525\" y2=\"254.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"307.78622399182535\" y1=\"0.0\" x2=\"307.78622399182535\" y2=\"254.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=\"228.60000000000002\" x2=\"341.9846933242504\" y2=\"228.60000000000002\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"0.0\" y1=\"177.8\" x2=\"341.9846933242504\" y2=\"177.8\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"0.0\" y1=\"127.0\" x2=\"341.9846933242504\" y2=\"127.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"0.0\" y1=\"76.19999999999999\" x2=\"341.9846933242504\" y2=\"76.19999999999999\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"0.0\" y1=\"25.39999999999999\" x2=\"341.9846933242504\" y2=\"25.39999999999999\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g clip-path=\"url(#c7SHsha)\" clip-bounds-jfx=\"[rect (31.015306675749617, 0.0), (341.9846933242504, 254.0)]\">\n",
" <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
" <g>\n",
" <g>\n",
" <g>\n",
" <g >\n",
" <circle fill=\"#da8459\" stroke=\"#da8459\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"170.9923466621252\" cy=\"127.0\" r=\"11.0\" />\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g transform=\"rotate(0.0 170.9923466621252 127.0 ) \">\n",
" <g transform=\"translate(170.9923466621252 131.2 ) \">\n",
" <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
" <tspan>text without nudge</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <defs>\n",
" <clipPath id=\"cHYV0Pj\">\n",
" <rect x=\"31.015306675749617\" y=\"0.0\" width=\"341.9846933242504\" height=\"254.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"c7SHsha\">\n",
" <rect x=\"31.015306675749617\" y=\"0.0\" width=\"341.9846933242504\" height=\"254.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" </g>\n",
" <g>\n",
" <g transform=\"translate(31.015306675749617 254.0 ) \">\n",
" <g transform=\"translate(34.19846933242502 0.0 ) \">\n",
" <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
" </line>\n",
" <g transform=\"translate(0.0 6.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
" <tspan>-0.4</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(102.5954079972751 0.0 ) \">\n",
" <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
" </line>\n",
" <g transform=\"translate(0.0 6.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
" <tspan>-0.2</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(170.9923466621252 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(239.38928532697525 0.0 ) \">\n",
" <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
" </line>\n",
" <g transform=\"translate(0.0 6.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
" <tspan>0.2</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(307.78622399182535 0.0 ) \">\n",
" <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
" </line>\n",
" <g transform=\"translate(0.0 6.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
" <tspan>0.4</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <line x1=\"0.0\" y1=\"0.0\" x2=\"341.9846933242504\" y2=\"0.0\" stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\">\n",
" </line>\n",
" </g>\n",
" <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
" <g transform=\"translate(0.0 228.60000000000002 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>-0.4</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 177.8 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>-0.2</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 127.0 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>0</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 76.19999999999999 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>0.2</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 25.39999999999999 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>0.4</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(15.0 133.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(223.00765333787479 294.0 ) \">\n",
" <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"axis-title-x\" text-anchor=\"middle\">\n",
" <tspan>x</tspan>\n",
" </text>\n",
" </g>\n",
" <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 300.0 L400.0 300.0 L400.0 0.0 Z\" pointer-events=\"none\">\n",
" </path>\n",
" </g>\n",
" <g id=\"doXqAJk\">\n",
" </g>\n",
"</svg>\n",
" <script>document.getElementById(\"366a6fe1-b47d-46f3-ba63-69cb4d5c06e4\").style.display = \"none\";</script>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"letsPlot() + \n",
" geomPoint(x = 0, y = 0, size = 10, color = \"#DA8459\") + \n",
" geomText(x = 0, y = 0, label = \"text without nudge\") + \n",
" ggsize(400, 300)"
]
},
{
"cell_type": "markdown",
"id": "1e8597bb-2986-429c-bab3-26a58f89bddf",
"metadata": {},
"source": [
"#### 2. Unit Comparison: Pixel, Size, and Identity\n",
"\n",
"The `\"size\"` unit enables precise positioning relative to point dimensions.\n",
"\n",
"In this example, the point has `size = 30` and text is positioned at half that distance (`nudgeY = 15`). When combined with `vjust`/`hjust`, this allows for placing text at specific locations relative to the point boundary."
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "8acd87f8-94f4-4d5a-81a6-a2e5a0e8a71f",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-03T15:57:46.612528Z",
"iopub.status.busy": "2025-12-03T15:57:46.612040Z",
"iopub.status.idle": "2025-12-03T15:57:46.729554Z",
"shell.execute_reply": "2025-12-03T15:57:46.729374Z"
}
},
"outputs": [
{
"data": {
"application/plot+json": {
"apply_color_scheme": true,
"output": {
"kind": "plot",
"layers": [
{
"color": "#B9534C",
"geom": "point",
"mapping": {},
"position": "identity",
"size": 5.0,
"stat": "identity",
"x": 0.0,
"y": 1.0
},
{
"geom": "text",
"label": "identity 0.2",
"mapping": {},
"nudge_y": 0.2,
"position": "identity",
"stat": "identity",
"x": 0.0,
"y": 1.0
},
{
"color": "#DA8459",
"geom": "point",
"mapping": {},
"position": "identity",
"size": 5.0,
"stat": "identity",
"x": 1.0,
"y": 1.0
},
{
"geom": "text",
"label": "px 40",
"mapping": {},
"nudge_unit": "px",
"nudge_y": 40.0,
"position": "identity",
"stat": "identity",
"x": 1.0,
"y": 1.0
},
{
"color": "#EEAB65",
"geom": "point",
"mapping": {},
"position": "identity",
"size": 30.0,
"stat": "identity",
"x": 2.0,
"y": 1.0
},
{
"geom": "text",
"label": "size 15",
"mapping": {},
"nudge_unit": "size",
"nudge_y": 15.0,
"position": "identity",
"stat": "identity",
"x": 2.0,
"y": 1.0
},
{
"color": "#F6C971",
"geom": "point",
"mapping": {},
"position": "identity",
"size": 30.0,
"stat": "identity",
"x": 3.0,
"y": 1.0
},
{
"geom": "text",
"label": "size 15 vjust 0",
"mapping": {},
"nudge_unit": "size",
"nudge_y": 15.0,
"position": "identity",
"stat": "identity",
"vjust": 0.0,
"x": 3.0,
"y": 1.0
},
{
"geom": "text",
"label": "size -15 vjust 1",
"mapping": {},
"nudge_unit": "size",
"nudge_y": -15.0,
"position": "identity",
"stat": "identity",
"vjust": 1.0,
"x": 3.0,
"y": 1.0
}
],
"mapping": {},
"scales": [
{
"aesthetic": "x",
"limits": [
-1.0,
4.0
]
}
]
},
"output_type": "lets_plot_spec",
"swing_enabled": true
},
"text/html": [
" <div id=\"U8CzKf\" ></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(\"U8CzKf\");\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\":\"x\",\n",
"\"limits\":[-1.0,4.0]\n",
"}],\n",
"\"layers\":[{\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"color\":\"#B9534C\",\n",
"\"size\":5.0,\n",
"\"x\":0.0,\n",
"\"y\":1.0,\n",
"\"position\":\"identity\",\n",
"\"geom\":\"point\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"nudge_y\":0.2,\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"x\":0.0,\n",
"\"y\":1.0,\n",
"\"position\":\"identity\",\n",
"\"label\":\"identity 0.2\",\n",
"\"geom\":\"text\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"color\":\"#DA8459\",\n",
"\"size\":5.0,\n",
"\"x\":1.0,\n",
"\"y\":1.0,\n",
"\"position\":\"identity\",\n",
"\"geom\":\"point\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"nudge_y\":40.0,\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"x\":1.0,\n",
"\"y\":1.0,\n",
"\"position\":\"identity\",\n",
"\"label\":\"px 40\",\n",
"\"geom\":\"text\",\n",
"\"nudge_unit\":\"px\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"color\":\"#EEAB65\",\n",
"\"size\":30.0,\n",
"\"x\":2.0,\n",
"\"y\":1.0,\n",
"\"position\":\"identity\",\n",
"\"geom\":\"point\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"nudge_y\":15.0,\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"x\":2.0,\n",
"\"y\":1.0,\n",
"\"position\":\"identity\",\n",
"\"label\":\"size 15\",\n",
"\"geom\":\"text\",\n",
"\"nudge_unit\":\"size\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"color\":\"#F6C971\",\n",
"\"size\":30.0,\n",
"\"x\":3.0,\n",
"\"y\":1.0,\n",
"\"position\":\"identity\",\n",
"\"geom\":\"point\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"nudge_y\":15.0,\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"vjust\":0.0,\n",
"\"x\":3.0,\n",
"\"y\":1.0,\n",
"\"position\":\"identity\",\n",
"\"label\":\"size 15 vjust 0\",\n",
"\"geom\":\"text\",\n",
"\"nudge_unit\":\"size\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"nudge_y\":-15.0,\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"vjust\":1.0,\n",
"\"x\":3.0,\n",
"\"y\":1.0,\n",
"\"position\":\"identity\",\n",
"\"label\":\"size -15 vjust 1\",\n",
"\"geom\":\"text\",\n",
"\"nudge_unit\":\"size\",\n",
"\"data\":{\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=48bf1709-9072-46ac-97b8-9e51fe87dc47 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",
"#pUgYMix .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",
"#pUgYMix .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",
"#pUgYMix .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",
"#pUgYMix .hyperlink-element {\n",
"fill: #118ed8;\n",
"font-weight: normal;\n",
"font-style: normal;\n",
"\n",
"}\n",
"#pUgYMix .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",
"#pUgYMix .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",
"#pUgYMix .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",
"#pUgYMix .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",
"#da0KKmT .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",
"#pUgYMix .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",
"#pUgYMix .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",
"#da0KKmT .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",
"#pUgYMix .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",
"#pUgYMix .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",
"#da0KKmT .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",
"#da0KKmT .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",
"#da0KKmT .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=\"pUgYMix\">\n",
" <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\">\n",
" </path>\n",
" <g transform=\"translate(21.0 6.0 ) \">\n",
" <g>\n",
" <g transform=\"translate(23.034701220281416 0.0 ) \">\n",
" <g>\n",
" <line x1=\"24.9984226718054\" y1=\"0.0\" x2=\"24.9984226718054\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"124.99211335902697\" y1=\"0.0\" x2=\"124.99211335902697\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"224.98580404624855\" y1=\"0.0\" x2=\"224.98580404624855\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"324.9794947334701\" y1=\"0.0\" x2=\"324.9794947334701\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"424.97318542069166\" y1=\"0.0\" x2=\"424.97318542069166\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"524.9668761079133\" y1=\"0.0\" x2=\"524.9668761079133\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(23.034701220281416 0.0 ) \">\n",
" <g>\n",
" <line x1=\"0.0\" y1=\"318.59999999999997\" x2=\"549.9652987797186\" y2=\"318.59999999999997\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"0.0\" y1=\"247.8\" x2=\"549.9652987797186\" y2=\"247.8\" 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=\"549.9652987797186\" 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=\"106.19999999999999\" x2=\"549.9652987797186\" y2=\"106.19999999999999\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"0.0\" y1=\"35.400000000000034\" x2=\"549.9652987797186\" y2=\"35.400000000000034\" 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(#cPZQAlP)\" clip-bounds-jfx=\"[rect (23.034701220281416, 0.0), (549.9652987797186, 354.0)]\">\n",
" <g transform=\"translate(23.034701220281416 0.0 ) \">\n",
" <g>\n",
" <g>\n",
" <g>\n",
" <g >\n",
" <circle fill=\"#b9534c\" stroke=\"#b9534c\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"124.99211335902697\" cy=\"177.0\" r=\"5.5\" />\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g transform=\"rotate(0.0 124.99211335902697 106.19999999999999 ) \">\n",
" <g transform=\"translate(124.99211335902697 110.39999999999999 ) \">\n",
" <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
" <tspan>identity 0.2</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g>\n",
" <g >\n",
" <circle fill=\"#da8459\" stroke=\"#da8459\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"224.98580404624855\" cy=\"177.0\" r=\"5.5\" />\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g transform=\"rotate(0.0 224.98580404624855 137.0 ) \">\n",
" <g transform=\"translate(224.98580404624855 141.2 ) \">\n",
" <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
" <tspan>px 40</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g>\n",
" <g >\n",
" <circle fill=\"#eeab65\" stroke=\"#eeab65\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"324.9794947334701\" cy=\"177.0\" r=\"33.0\" />\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g transform=\"rotate(0.0 324.9794947334701 144.0 ) \">\n",
" <g transform=\"translate(324.9794947334701 148.2 ) \">\n",
" <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
" <tspan>size 15</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g>\n",
" <g >\n",
" <circle fill=\"#f6c971\" stroke=\"#f6c971\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"424.97318542069166\" cy=\"177.0\" r=\"33.0\" />\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g transform=\"rotate(0.0 424.97318542069166 144.0 ) \">\n",
" <g transform=\"translate(424.97318542069166 144.0 ) \">\n",
" <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
" <tspan>size 15 vjust 0</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g transform=\"rotate(0.0 424.97318542069166 210.0 ) \">\n",
" <g transform=\"translate(424.97318542069166 219.8 ) \">\n",
" <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
" <tspan>size -15 vjust 1</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <defs>\n",
" <clipPath id=\"cEp5rwk\">\n",
" <rect x=\"23.034701220281416\" y=\"0.0\" width=\"549.9652987797186\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"cqLVMI5\">\n",
" <rect x=\"23.034701220281416\" y=\"0.0\" width=\"549.9652987797186\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"cw57KzG\">\n",
" <rect x=\"23.034701220281416\" y=\"0.0\" width=\"549.9652987797186\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"cXc3FCX\">\n",
" <rect x=\"23.034701220281416\" y=\"0.0\" width=\"549.9652987797186\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"cXaDgb4\">\n",
" <rect x=\"23.034701220281416\" y=\"0.0\" width=\"549.9652987797186\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"cPh37GF\">\n",
" <rect x=\"23.034701220281416\" y=\"0.0\" width=\"549.9652987797186\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"c1GsjLJ\">\n",
" <rect x=\"23.034701220281416\" y=\"0.0\" width=\"549.9652987797186\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"cPi7TmE\">\n",
" <rect x=\"23.034701220281416\" y=\"0.0\" width=\"549.9652987797186\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"cPZQAlP\">\n",
" <rect x=\"23.034701220281416\" y=\"0.0\" width=\"549.9652987797186\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" </g>\n",
" <g>\n",
" <g transform=\"translate(23.034701220281416 354.0 ) \">\n",
" <g transform=\"translate(24.9984226718054 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(124.99211335902697 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(224.98580404624855 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(324.9794947334701 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(424.97318542069166 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>3</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(524.9668761079133 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>4</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <line x1=\"0.0\" y1=\"0.0\" x2=\"549.9652987797186\" y2=\"0.0\" stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\">\n",
" </line>\n",
" </g>\n",
" <g transform=\"translate(23.034701220281416 0.0 ) \">\n",
" <g transform=\"translate(0.0 318.59999999999997 ) \">\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.6</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 247.8 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>0.8</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 177.0 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>1</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 106.19999999999999 ) \">\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.2</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 35.400000000000034 ) \">\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.4</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(319.01735061014074 394.0 ) \">\n",
" <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"axis-title-x\" text-anchor=\"middle\">\n",
" <tspan>x</tspan>\n",
" </text>\n",
" </g>\n",
" <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\" pointer-events=\"none\">\n",
" </path>\n",
" </g>\n",
" <g id=\"da0KKmT\">\n",
" </g>\n",
"</svg>\n",
" <script>document.getElementById(\"48bf1709-9072-46ac-97b8-9e51fe87dc47\").style.display = \"none\";</script>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"letsPlot() +\n",
" xlim(-1 to 4) +\n",
" geomPoint(x = 0, y = 1, size = 5, color = \"#B9534C\") +\n",
" geomText(x = 0, y = 1, label = \"identity 0.2\", nudgeY = 0.2) +\n",
" geomPoint(x = 1, y = 1, size = 5, color = \"#DA8459\") +\n",
" geomText(x = 1, y = 1, label = \"px 40\", nudgeY = 40, nudgeUnit = \"px\") +\n",
" geomPoint(x = 2, y = 1, size = 30, color = \"#EEAB65\") +\n",
" geomText(x = 2, y = 1, label = \"size 15\", nudgeY = 15, nudgeUnit = \"size\") +\n",
" geomPoint(x = 3, y = 1, size = 30, color = \"#F6C971\") +\n",
" geomText(x = 3, y = 1, label = \"size 15 vjust 0\", nudgeY = 15, vjust = 0, nudgeUnit = \"size\") +\n",
" geomText(x = 3, y = 1, label = \"size -15 vjust 1\", nudgeY = -15, vjust = 1, nudgeUnit = \"size\")"
]
},
{
"cell_type": "markdown",
"id": "b8f317a8-5aec-4ba7-8646-cbad83c13742",
"metadata": {},
"source": [
"#### 3. Parameter `unit` in `positionNudge()`"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "7abb1d30-0e36-409a-bad4-acd11b86c9b7",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-03T15:57:46.731770Z",
"iopub.status.busy": "2025-12-03T15:57:46.731302Z",
"iopub.status.idle": "2025-12-03T15:57:46.792879Z",
"shell.execute_reply": "2025-12-03T15:57:46.793000Z"
}
},
"outputs": [
{
"data": {
"application/plot+json": {
"apply_color_scheme": true,
"output": {
"kind": "plot",
"layers": [
{
"color": "#DA8459",
"geom": "point",
"mapping": {},
"position": "identity",
"size": 50.0,
"stat": "identity",
"x": 0.0,
"y": 0.0
},
{
"color": "blue",
"geom": "point",
"mapping": {},
"position": {
"name": "nudge",
"unit": "size",
"x": 0.0,
"y": 25.0
},
"size": 20.0,
"stat": "identity",
"x": 0.0,
"y": 0.0
},
{
"geom": "text",
"label": "positionNudge size 25",
"mapping": {},
"position": {
"name": "nudge",
"unit": "size",
"x": 50.0,
"y": 25.0
},
"stat": "identity",
"x": 0.0,
"y": 0.0
}
],
"mapping": {},
"scales": []
},
"output_type": "lets_plot_spec",
"swing_enabled": true
},
"text/html": [
" <div id=\"fWc5Qm\" ></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(\"fWc5Qm\");\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",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"color\":\"#DA8459\",\n",
"\"size\":50.0,\n",
"\"x\":0.0,\n",
"\"y\":0.0,\n",
"\"position\":\"identity\",\n",
"\"geom\":\"point\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"color\":\"blue\",\n",
"\"size\":20.0,\n",
"\"x\":0.0,\n",
"\"y\":0.0,\n",
"\"position\":{\n",
"\"name\":\"nudge\",\n",
"\"x\":0.0,\n",
"\"y\":25.0,\n",
"\"unit\":\"size\"\n",
"},\n",
"\"geom\":\"point\",\n",
"\"data\":{\n",
"}\n",
"},{\n",
"\"mapping\":{\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"x\":0.0,\n",
"\"y\":0.0,\n",
"\"position\":{\n",
"\"name\":\"nudge\",\n",
"\"x\":50.0,\n",
"\"y\":25.0,\n",
"\"unit\":\"size\"\n",
"},\n",
"\"label\":\"positionNudge size 25\",\n",
"\"geom\":\"text\",\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=a9eba307-2b3d-4144-8c06-2e2b2c02cabd 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",
"#pyJjXFh .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",
"#pyJjXFh .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",
"#pyJjXFh .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",
"#pyJjXFh .hyperlink-element {\n",
"fill: #118ed8;\n",
"font-weight: normal;\n",
"font-style: normal;\n",
"\n",
"}\n",
"#pyJjXFh .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",
"#pyJjXFh .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",
"#pyJjXFh .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",
"#pyJjXFh .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",
"#d2AHlab .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",
"#pyJjXFh .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",
"#pyJjXFh .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",
"#d2AHlab .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",
"#pyJjXFh .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",
"#pyJjXFh .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",
"#d2AHlab .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",
"#d2AHlab .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",
"#d2AHlab .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=\"pyJjXFh\">\n",
" <path fill-rule=\"evenodd\" fill=\"rgb(255,255,255)\" fill-opacity=\"1.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\">\n",
" </path>\n",
" <g transform=\"translate(21.0 6.0 ) \">\n",
" <g>\n",
" <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
" <g>\n",
" <line x1=\"54.19846933242502\" y1=\"0.0\" x2=\"54.19846933242502\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"162.59540799727512\" y1=\"0.0\" x2=\"162.59540799727512\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"270.9923466621252\" y1=\"0.0\" x2=\"270.9923466621252\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"379.3892853269753\" y1=\"0.0\" x2=\"379.3892853269753\" y2=\"354.0\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"487.7862239918254\" y1=\"0.0\" x2=\"487.7862239918254\" 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=\"318.6\" x2=\"541.9846933242504\" y2=\"318.6\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"0.0\" y1=\"247.8\" x2=\"541.9846933242504\" y2=\"247.8\" 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=\"541.9846933242504\" 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=\"106.2\" x2=\"541.9846933242504\" y2=\"106.2\" stroke=\"rgb(233,233,233)\" stroke-opacity=\"1.0\" stroke-width=\"1.0\" fill=\"none\">\n",
" </line>\n",
" <line x1=\"0.0\" y1=\"35.400000000000006\" x2=\"541.9846933242504\" y2=\"35.400000000000006\" 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(#ckLAbdq)\" clip-bounds-jfx=\"[rect (31.015306675749617, 0.0), (541.9846933242504, 354.0)]\">\n",
" <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
" <g>\n",
" <g>\n",
" <g>\n",
" <g >\n",
" <circle fill=\"#da8459\" stroke=\"#da8459\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"270.9923466621252\" cy=\"177.0\" r=\"55.00000000000001\" />\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g>\n",
" <g >\n",
" <circle fill=\"#0000ff\" stroke=\"#0000ff\" stroke-opacity=\"0.0\" stroke-width=\"0.0\" cx=\"270.9923466621252\" cy=\"122.0\" r=\"22.0\" />\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g>\n",
" <g transform=\"rotate(0.0 380.9923466621252 122.0 ) \">\n",
" <g transform=\"translate(380.9923466621252 126.2 ) \">\n",
" <text style=\"fill:#474747;font-size:14.0px;font-family:sans-serif;\" y=\"0.0\" fill-opacity=\"1.0\" text-anchor=\"middle\">\n",
" <tspan>positionNudge size 25</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <defs>\n",
" <clipPath id=\"c6JYXg7\">\n",
" <rect x=\"31.015306675749617\" y=\"0.0\" width=\"541.9846933242504\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"cnbPgSB\">\n",
" <rect x=\"31.015306675749617\" y=\"0.0\" width=\"541.9846933242504\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" <defs>\n",
" <clipPath id=\"ckLAbdq\">\n",
" <rect x=\"31.015306675749617\" y=\"0.0\" width=\"541.9846933242504\" height=\"354.0\">\n",
" </rect>\n",
" </clipPath>\n",
" </defs>\n",
" </g>\n",
" <g>\n",
" <g transform=\"translate(31.015306675749617 354.0 ) \">\n",
" <g transform=\"translate(54.19846933242502 0.0 ) \">\n",
" <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
" </line>\n",
" <g transform=\"translate(0.0 6.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
" <tspan>-0.4</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(162.59540799727512 0.0 ) \">\n",
" <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
" </line>\n",
" <g transform=\"translate(0.0 6.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
" <tspan>-0.2</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(270.9923466621252 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(379.3892853269753 0.0 ) \">\n",
" <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
" </line>\n",
" <g transform=\"translate(0.0 6.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
" <tspan>0.2</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(487.7862239918254 0.0 ) \">\n",
" <line stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" x2=\"0.0\" y2=\"4.0\">\n",
" </line>\n",
" <g transform=\"translate(0.0 6.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-x\" text-anchor=\"middle\" dy=\"0.7em\">\n",
" <tspan>0.4</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <line x1=\"0.0\" y1=\"0.0\" x2=\"541.9846933242504\" y2=\"0.0\" stroke-width=\"1.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\">\n",
" </line>\n",
" </g>\n",
" <g transform=\"translate(31.015306675749617 0.0 ) \">\n",
" <g transform=\"translate(0.0 318.6 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>-0.4</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 247.8 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>-0.2</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 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</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 106.2 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>0.2</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(0.0 35.400000000000006 ) \">\n",
" <g transform=\"translate(-2.0 0.0 ) \">\n",
" <text style=\"font-size:13.0px;\" y=\"0.0\" class=\"axis-text-y\" text-anchor=\"end\" dy=\"0.35em\">\n",
" <tspan>0.4</tspan>\n",
" </text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g transform=\"translate(15.0 183.0 ) rotate(-90.0 ) \">\n",
" <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"axis-title-y\" text-anchor=\"middle\">\n",
" <tspan>y</tspan>\n",
" </text>\n",
" </g>\n",
" <g transform=\"translate(323.00765333787484 394.0 ) \">\n",
" <text style=\"font-size:15.0px;\" y=\"0.0\" class=\"axis-title-x\" text-anchor=\"middle\">\n",
" <tspan>x</tspan>\n",
" </text>\n",
" </g>\n",
" <path fill=\"rgb(0,0,0)\" fill-opacity=\"0.0\" stroke=\"rgb(71,71,71)\" stroke-opacity=\"1.0\" stroke-width=\"0.0\" d=\"M0.0 0.0 L0.0 400.0 L600.0 400.0 L600.0 0.0 Z\" pointer-events=\"none\">\n",
" </path>\n",
" </g>\n",
" <g id=\"d2AHlab\">\n",
" </g>\n",
"</svg>\n",
" <script>document.getElementById(\"a9eba307-2b3d-4144-8c06-2e2b2c02cabd\").style.display = \"none\";</script>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"letsPlot() + \n",
" geomPoint(x = 0, y = 0, size = 50, color = \"#DA8459\") + \n",
" geomPoint(x = 0, y = 0, size = 20, color = \"blue\", position = positionNudge(0, 25, \"size\")) + \n",
" geomText(x = 0, y = 0, label = \"positionNudge size 25\", position = positionNudge(50, 25, \"size\"))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Kotlin",
"language": "kotlin",
"name": "kotlin"
},
"language_info": {
"codemirror_mode": "text/x-kotlin",
"file_extension": ".kt",
"mimetype": "text/x-kotlin",
"name": "kotlin",
"nbconvert_exporter": "",
"pygments_lexer": "kotlin",
"version": "2.2.20-Beta2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}