Skip to content

Commit

Permalink
Update theme_plot_message.ipynb - mention a notebook-wide computation…
Browse files Browse the repository at this point in the history
… message suppression
  • Loading branch information
IKupriyanov-HORIS committed Sep 15, 2023
1 parent 94bf3c5 commit 209d5b4
Showing 1 changed file with 88 additions and 220 deletions.
308 changes: 88 additions & 220 deletions docs/examples/jupyter-notebooks/f-4.4.3/theme_plot_message.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{
"data": {
"text/html": [
" <div id=\"4Nszfu\"></div>\n",
" <div id=\"jmiznB\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
" if(!window.letsPlotCallQueue) {\n",
" window.letsPlotCallQueue = [];\n",
Expand All @@ -56,230 +56,21 @@
" var div = document.createElement(\"div\");\n",
" div.style.color = 'darkred';\n",
" div.textContent = 'Error loading Lets-Plot JS';\n",
" document.getElementById(\"4Nszfu\").appendChild(div);\n",
" document.getElementById(\"jmiznB\").appendChild(div);\n",
" };\n",
" var e = document.getElementById(\"4Nszfu\");\n",
" var e = document.getElementById(\"jmiznB\");\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[\"DataFrame\"]) {\n",
" var resQueue = [];\n",
" window.kotlinQueues[\"DataFrame\"] = resQueue;\n",
" window[\"call_DataFrame\"] = function(f) {\n",
" resQueue.push(f);\n",
" }\n",
" }\n",
" (function (){\n",
" var modifiers = [(function(script) {\n",
" script.src = \"https://cdn.jsdelivr.net/gh/Kotlin/dataframe@3db46ccccaa1291c0627307d64133317f545e6ae/core/src/main/resources/init.js\"\n",
" script.type = \"text/javascript\";\n",
"})];\n",
" var e = document.getElementById(\"kotlin_out_0\");\n",
" modifiers.forEach(function (gen) {\n",
" var script = document.createElement(\"script\");\n",
" gen(script)\n",
" script.addEventListener(\"load\", function() {\n",
" window[\"call_DataFrame\"] = function(f) {f();};\n",
" window.kotlinQueues[\"DataFrame\"].forEach(function(f) {f();});\n",
" window.kotlinQueues[\"DataFrame\"] = [];\n",
" }, false);\n",
" script.addEventListener(\"error\", function() {\n",
" window[\"call_DataFrame\"] = function(f) {};\n",
" window.kotlinQueues[\"DataFrame\"] = [];\n",
" var div = document.createElement(\"div\");\n",
" div.style.color = 'darkred';\n",
" div.textContent = 'Error loading resource DataFrame';\n",
" document.getElementById(\"kotlin_out_0\").appendChild(div);\n",
" }, false);\n",
" \n",
" e.appendChild(script);\n",
" });\n",
" })();\n",
" </script>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" <style>\n",
" :root {\n",
" --background: #fff;\n",
" --background-odd: #f5f5f5;\n",
" --background-hover: #d9edfd;\n",
" --header-text-color: #474747;\n",
" --text-color: #848484;\n",
" --text-color-dark: #000;\n",
" --text-color-medium: #737373;\n",
" --text-color-pale: #b3b3b3;\n",
" --inner-border-color: #aaa;\n",
" --bold-border-color: #000;\n",
" --link-color: #296eaa;\n",
" --link-color-pale: #296eaa;\n",
" --link-hover: #1a466c;\n",
"}\n",
"\n",
":root[theme=\"dark\"], :root [data-jp-theme-light=\"false\"], .dataframe_dark{\n",
" --background: #303030;\n",
" --background-odd: #3c3c3c;\n",
" --background-hover: #464646;\n",
" --header-text-color: #dddddd;\n",
" --text-color: #b3b3b3;\n",
" --text-color-dark: #dddddd;\n",
" --text-color-medium: #b2b2b2;\n",
" --text-color-pale: #737373;\n",
" --inner-border-color: #707070;\n",
" --bold-border-color: #777777;\n",
" --link-color: #008dc0;\n",
" --link-color-pale: #97e1fb;\n",
" --link-hover: #00688e;\n",
"}\n",
"\n",
"p.dataframe_description {\n",
" color: var(--text-color-dark);\n",
"}\n",
"\n",
"table.dataframe {\n",
" font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n",
" font-size: 12px;\n",
" background-color: var(--background);\n",
" color: var(--text-color-dark);\n",
" border: none;\n",
" border-collapse: collapse;\n",
"}\n",
"\n",
"table.dataframe th, td {\n",
" padding: 6px;\n",
" border: 1px solid transparent;\n",
" text-align: left;\n",
"}\n",
"\n",
"table.dataframe th {\n",
" background-color: var(--background);\n",
" color: var(--header-text-color);\n",
"}\n",
"\n",
"table.dataframe td {\n",
" vertical-align: top;\n",
"}\n",
"\n",
"table.dataframe th.bottomBorder {\n",
" border-bottom-color: var(--bold-border-color);\n",
"}\n",
"\n",
"table.dataframe tbody > tr:nth-child(odd) {\n",
" background: var(--background-odd);\n",
"}\n",
"\n",
"table.dataframe tbody > tr:nth-child(even) {\n",
" background: var(--background);\n",
"}\n",
"\n",
"table.dataframe tbody > tr:hover {\n",
" background: var(--background-hover);\n",
"}\n",
"\n",
"table.dataframe a {\n",
" cursor: pointer;\n",
" color: var(--link-color);\n",
" text-decoration: none;\n",
"}\n",
"\n",
"table.dataframe tr:hover > td a {\n",
" color: var(--link-color-pale);\n",
"}\n",
"\n",
"table.dataframe a:hover {\n",
" color: var(--link-hover);\n",
" text-decoration: underline;\n",
"}\n",
"\n",
"table.dataframe img {\n",
" max-width: fit-content;\n",
"}\n",
"\n",
"table.dataframe th.complex {\n",
" background-color: var(--background);\n",
" border: 1px solid var(--background);\n",
"}\n",
"\n",
"table.dataframe .leftBorder {\n",
" border-left-color: var(--inner-border-color);\n",
"}\n",
"\n",
"table.dataframe .rightBorder {\n",
" border-right-color: var(--inner-border-color);\n",
"}\n",
"\n",
"table.dataframe .rightAlign {\n",
" text-align: right;\n",
"}\n",
"\n",
"table.dataframe .expanderSvg {\n",
" width: 8px;\n",
" height: 8px;\n",
" margin-right: 3px;\n",
"}\n",
"\n",
"table.dataframe .expander {\n",
" display: flex;\n",
" align-items: center;\n",
"}\n",
"\n",
"/* formatting */\n",
"\n",
"table.dataframe .null {\n",
" color: var(--text-color-pale);\n",
"}\n",
"\n",
"table.dataframe .structural {\n",
" color: var(--text-color-medium);\n",
" font-weight: bold;\n",
"}\n",
"\n",
"table.dataframe .dataFrameCaption {\n",
" font-weight: bold;\n",
"}\n",
"\n",
"table.dataframe .numbers {\n",
" color: var(--text-color-dark);\n",
"}\n",
"\n",
"table.dataframe td:hover .formatted .structural, .null {\n",
" color: var(--text-color-dark);\n",
"}\n",
"\n",
"table.dataframe tr:hover .formatted .structural, .null {\n",
" color: var(--text-color-dark);\n",
"}\n",
"\n",
"\n",
" </style>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%useLatestDescriptors\n",
"%use lets-plot\n",
"%use dataframe"
"%use lets-plot"
]
},
{
Expand Down Expand Up @@ -313,7 +104,7 @@
{
"data": {
"text/html": [
" <div id=\"dZnhfY\"></div>\n",
" <div id=\"xs3sEz\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
" (function() {\n",
" var plotSpec={\n",
Expand All @@ -335,12 +126,12 @@
"\"position\":\"identity\",\n",
"\"geom\":\"point\",\n",
"\"data\":{\n",
"\"x\":[0.0,1.0,2.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0]\n",
"\"x\":[0.0,1.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0]\n",
"}\n",
"}],\n",
"\"computation_messages\":[\"sampling_random(n=10) was applied to [point/identity stat] layer\"]\n",
"};\n",
" var plotContainer = document.getElementById(\"dZnhfY\");\n",
" var plotContainer = document.getElementById(\"xs3sEz\");\n",
" window.letsPlotCall(function() {{\n",
" LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
Expand All @@ -354,7 +145,7 @@
}
],
"source": [
"val p = letsPlot(d) + geomPoint(sampling=samplingRandom(n=10)){ x=\"x\" }\n",
"val p = letsPlot(d) + geomPoint(sampling = samplingRandom(n = 10)) { x = \"x\" }\n",
"p"
]
},
Expand Down Expand Up @@ -382,7 +173,7 @@
{
"data": {
"text/html": [
" <div id=\"bfvGaa\"></div>\n",
" <div id=\"L7n8gY\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
" (function() {\n",
" var plotSpec={\n",
Expand All @@ -404,7 +195,7 @@
"\"position\":\"identity\",\n",
"\"geom\":\"point\",\n",
"\"data\":{\n",
"\"x\":[0.0,1.0,2.0,3.0,4.0,6.0,7.0,8.0,9.0,10.0]\n",
"\"x\":[0.0,1.0,2.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0]\n",
"}\n",
"}],\n",
"\"theme\":{\n",
Expand All @@ -413,7 +204,7 @@
"}\n",
"}\n",
"};\n",
" var plotContainer = document.getElementById(\"bfvGaa\");\n",
" var plotContainer = document.getElementById(\"L7n8gY\");\n",
" window.letsPlotCall(function() {{\n",
" LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
Expand All @@ -429,6 +220,83 @@
"source": [
"p + theme(plotMessage=elementBlank())"
]
},
{
"cell_type": "markdown",
"id": "26e5886e-e3e5-4fcc-bfab-3cea5ac3ffa0",
"metadata": {},
"source": [
"### Hiding plot messages for the whole notebook\n",
"\n",
"Using the `LestPlot.theme` property messages can be suppressed for the whole notebook."
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "f6f2ee74-8d2e-4fa0-b5dc-44b0bd16c74f",
"metadata": {},
"outputs": [],
"source": [
"LetsPlot.theme = theme(plotMessage = elementBlank())"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "f038cfd6-216d-41e1-a415-c1f7c3219107",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" <div id=\"CjAZrY\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
" (function() {\n",
" var plotSpec={\n",
"\"mapping\":{\n",
"},\n",
"\"data\":{\n",
"},\n",
"\"kind\":\"plot\",\n",
"\"scales\":[],\n",
"\"layers\":[{\n",
"\"mapping\":{\n",
"\"x\":\"x\"\n",
"},\n",
"\"stat\":\"identity\",\n",
"\"sampling\":{\n",
"\"n\":10.0,\n",
"\"name\":\"random\"\n",
"},\n",
"\"position\":\"identity\",\n",
"\"geom\":\"point\",\n",
"\"data\":{\n",
"\"x\":[0.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0]\n",
"}\n",
"}],\n",
"\"theme\":{\n",
"\"plot_message\":{\n",
"\"blank\":true\n",
"}\n",
"}\n",
"};\n",
" var plotContainer = document.getElementById(\"CjAZrY\");\n",
" window.letsPlotCall(function() {{\n",
" LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
" }});\n",
" })(); \n",
" </script>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"letsPlot(d) + geomPoint(sampling = samplingRandom(n = 10)) { x = \"x\" }"
]
}
],
"metadata": {
Expand Down

0 comments on commit 209d5b4

Please sign in to comment.