|
6 | 6 | "source": [
|
7 | 7 | "<em><sub>This page is available as an executable or viewable <strong>Jupyter Notebook</strong>:</sub></em>\n",
|
8 | 8 | "<br/><br/>\n",
|
9 |
| - "<a href=\"https://mybinder.org/v2/gh/JetBrains/lets-plot-kotlin/v1.3.0demos1?filepath=docs%2Fexamples%2Fjupyter-notebooks%2Fcontours.ipynb\"\n", |
| 9 | + "<a href=\"https://mybinder.org/v2/gh/JetBrains/lets-plot-kotlin/v2.0.1demos1?filepath=docs%2Fexamples%2Fjupyter-notebooks%2Fcontours.ipynb\"\n", |
10 | 10 | " target=\"_parent\"> \n",
|
11 | 11 | " <img align=\"left\" \n",
|
12 | 12 | " src=\"https://mybinder.org/badge_logo.svg\">\n",
|
|
29 | 29 | {
|
30 | 30 | "data": {
|
31 | 31 | "text/html": [
|
32 |
| - " <div id=\"zX50nn\"></div>\n", |
| 32 | + " <div id=\"3lc3W4\"></div>\n", |
33 | 33 | " <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
|
34 | 34 | " if(!window.letsPlotCallQueue) {\n",
|
35 | 35 | " window.letsPlotCallQueue = [];\n",
|
|
40 | 40 | " (function() {\n",
|
41 | 41 | " var script = document.createElement(\"script\");\n",
|
42 | 42 | " script.type = \"text/javascript\";\n",
|
43 |
| - " script.src = \"https://dl.bintray.com/jetbrains/lets-plot/lets-plot-2.0.1.min.js\";\n", |
| 43 | + " script.src = \"https://cdnjs.cloudflare.com/ajax/libs/lets-plot/2.0.2/lets-plot.min.js\";\n", |
44 | 44 | " script.onload = function() {\n",
|
45 | 45 | " window.letsPlotCall = function(f) {f();};\n",
|
46 | 46 | " window.letsPlotCallQueue.forEach(function(f) {f();});\n",
|
|
54 | 54 | " var div = document.createElement(\"div\");\n",
|
55 | 55 | " div.style.color = 'darkred';\n",
|
56 | 56 | " div.textContent = 'Error loading Lets-Plot JS';\n",
|
57 |
| - " document.getElementById(\"zX50nn\").appendChild(div);\n", |
| 57 | + " document.getElementById(\"3lc3W4\").appendChild(div);\n", |
58 | 58 | " };\n",
|
59 |
| - " var e = document.getElementById(\"zX50nn\");\n", |
| 59 | + " var e = document.getElementById(\"3lc3W4\");\n", |
60 | 60 | " e.appendChild(script);\n",
|
61 | 61 | " })();\n",
|
62 | 62 | " </script>"
|
|
115 | 115 | {
|
116 | 116 | "data": {
|
117 | 117 | "text/html": [
|
118 |
| - " <div id=\"WiT6eY\"></div>\n", |
| 118 | + " <div id=\"JqGZq8\"></div>\n", |
119 | 119 | " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
|
120 | 120 | " (function() {\n",
|
121 | 121 | " var plotSpec={\n",
|
|
144 | 144 | "'geom':\"tile\"\n",
|
145 | 145 | "}]\n",
|
146 | 146 | "};\n",
|
147 |
| - " var plotContainer = document.getElementById(\"WiT6eY\");\n", |
| 147 | + " var plotContainer = document.getElementById(\"JqGZq8\");\n", |
148 | 148 | " window.letsPlotCall(function() {{\n",
|
149 | 149 | " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
|
150 | 150 | " }});\n",
|
|
153 | 153 | ]
|
154 | 154 | },
|
155 | 155 | "execution_count": 4,
|
156 |
| - "metadata": { |
157 |
| - "new_classpath": [] |
158 |
| - }, |
| 156 | + "metadata": {}, |
159 | 157 | "output_type": "execute_result"
|
160 | 158 | }
|
161 | 159 | ],
|
162 | 160 | "source": [
|
163 |
| - "val p = lets_plot {x=X; y=Y; fill=Z}\n", |
164 |
| - "p + geom_tile() + scale_fill_hue()" |
| 161 | + "val p = letsPlot {x=X; y=Y; fill=Z}\n", |
| 162 | + "p + geomTile() + scaleFillHue()" |
165 | 163 | ]
|
166 | 164 | },
|
167 | 165 | {
|
|
172 | 170 | {
|
173 | 171 | "data": {
|
174 | 172 | "text/html": [
|
175 |
| - " <div id=\"7TmPRG\"></div>\n", |
| 173 | + " <div id=\"xdYlOd\"></div>\n", |
176 | 174 | " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
|
177 | 175 | " (function() {\n",
|
178 | 176 | " var plotSpec={\n",
|
|
205 | 203 | "'geom':\"tile\"\n",
|
206 | 204 | "}]\n",
|
207 | 205 | "};\n",
|
208 |
| - " var plotContainer = document.getElementById(\"7TmPRG\");\n", |
| 206 | + " var plotContainer = document.getElementById(\"xdYlOd\");\n", |
209 | 207 | " window.letsPlotCall(function() {{\n",
|
210 | 208 | " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
|
211 | 209 | " }});\n",
|
|
214 | 212 | ]
|
215 | 213 | },
|
216 | 214 | "execution_count": 5,
|
217 |
| - "metadata": { |
218 |
| - "new_classpath": [] |
219 |
| - }, |
| 215 | + "metadata": {}, |
220 | 216 | "output_type": "execute_result"
|
221 | 217 | }
|
222 | 218 | ],
|
223 | 219 | "source": [
|
224 | 220 | "// Lets use greyscale and also remove colorbar.\n",
|
225 |
| - "val p1 = p + geom_tile(alpha=.5) + scale_fill_grey(1, .2, guide=\"none\")\n", |
| 221 | + "val p1 = p + geomTile(alpha=.5) + scaleFillGrey(1, .2, guide=\"none\")\n", |
226 | 222 | "p1"
|
227 | 223 | ]
|
228 | 224 | },
|
|
234 | 230 | {
|
235 | 231 | "data": {
|
236 | 232 | "text/html": [
|
237 |
| - " <div id=\"mrgV8c\"></div>\n", |
| 233 | + " <div id=\"qK5tKx\"></div>\n", |
238 | 234 | " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
|
239 | 235 | " (function() {\n",
|
240 | 236 | " var plotSpec={\n",
|
|
280 | 276 | "'geom':\"contour\"\n",
|
281 | 277 | "}]\n",
|
282 | 278 | "};\n",
|
283 |
| - " var plotContainer = document.getElementById(\"mrgV8c\");\n", |
| 279 | + " var plotContainer = document.getElementById(\"qK5tKx\");\n", |
284 | 280 | " window.letsPlotCall(function() {{\n",
|
285 | 281 | " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
|
286 | 282 | " }});\n",
|
|
289 | 285 | ]
|
290 | 286 | },
|
291 | 287 | "execution_count": 6,
|
292 |
| - "metadata": { |
293 |
| - "new_classpath": [] |
294 |
| - }, |
| 288 | + "metadata": {}, |
295 | 289 | "output_type": "execute_result"
|
296 | 290 | }
|
297 | 291 | ],
|
298 | 292 | "source": [
|
299 | 293 | "// Add contours\n",
|
300 |
| - "p1 + geom_contour(color=\"red\") {z=Z}" |
| 294 | + "p1 + geomContour(color=\"red\") {z=Z}" |
301 | 295 | ]
|
302 | 296 | },
|
303 | 297 | {
|
|
308 | 302 | {
|
309 | 303 | "data": {
|
310 | 304 | "text/html": [
|
311 |
| - " <div id=\"i4ft6j\"></div>\n", |
| 305 | + " <div id=\"phhnHc\"></div>\n", |
312 | 306 | " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
|
313 | 307 | " (function() {\n",
|
314 | 308 | " var plotSpec={\n",
|
|
360 | 354 | "'geom':\"contour\"\n",
|
361 | 355 | "}]\n",
|
362 | 356 | "};\n",
|
363 |
| - " var plotContainer = document.getElementById(\"i4ft6j\");\n", |
| 357 | + " var plotContainer = document.getElementById(\"phhnHc\");\n", |
364 | 358 | " window.letsPlotCall(function() {{\n",
|
365 | 359 | " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
|
366 | 360 | " }});\n",
|
|
369 | 363 | ]
|
370 | 364 | },
|
371 | 365 | "execution_count": 7,
|
372 |
| - "metadata": { |
373 |
| - "new_classpath": [] |
374 |
| - }, |
| 366 | + "metadata": {}, |
375 | 367 | "output_type": "execute_result"
|
376 | 368 | }
|
377 | 369 | ],
|
378 | 370 | "source": [
|
379 | 371 | "// Set contour color by level\n",
|
380 |
| - "p1 + geom_contour {z=Z; color=\"..level..\"} + scale_color_gradient(low=\"dark_green\", high=\"yellow\")" |
| 372 | + "p1 + geomContour {z=Z; color=\"..level..\"} + scaleColorGradient(low=\"dark_green\", high=\"yellow\")" |
381 | 373 | ]
|
382 | 374 | },
|
383 | 375 | {
|
|
395 | 387 | {
|
396 | 388 | "data": {
|
397 | 389 | "text/html": [
|
398 |
| - " <div id=\"E3zxnv\"></div>\n", |
| 390 | + " <div id=\"JaIwM8\"></div>\n", |
399 | 391 | " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
|
400 | 392 | " (function() {\n",
|
401 | 393 | " var plotSpec={\n",
|
|
423 | 415 | "'geom':\"polygon\"\n",
|
424 | 416 | "}]\n",
|
425 | 417 | "};\n",
|
426 |
| - " var plotContainer = document.getElementById(\"E3zxnv\");\n", |
| 418 | + " var plotContainer = document.getElementById(\"JaIwM8\");\n", |
427 | 419 | " window.letsPlotCall(function() {{\n",
|
428 | 420 | " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
|
429 | 421 | " }});\n",
|
|
432 | 424 | ]
|
433 | 425 | },
|
434 | 426 | "execution_count": 8,
|
435 |
| - "metadata": { |
436 |
| - "new_classpath": [] |
437 |
| - }, |
| 427 | + "metadata": {}, |
438 | 428 | "output_type": "execute_result"
|
439 | 429 | }
|
440 | 430 | ],
|
441 | 431 | "source": [
|
442 |
| - "val p2 = ggplot {x=X; y=Y}\n", |
| 432 | + "val p2 = letsPlot {x=X; y=Y}\n", |
443 | 433 | "\n",
|
444 | 434 | "// Filled polygons are not working very well in this case\n",
|
445 |
| - "p2 + geom_polygon(stat=Stat.contour {z=Z}) {fill=\"..level..\"}" |
| 435 | + "p2 + geomPolygon(stat=Stat.contour {z=Z}) {fill=\"..level..\"}" |
446 | 436 | ]
|
447 | 437 | },
|
448 | 438 | {
|
|
453 | 443 | {
|
454 | 444 | "data": {
|
455 | 445 | "text/html": [
|
456 |
| - " <div id=\"g44PRA\"></div>\n", |
| 446 | + " <div id=\"fqzB2C\"></div>\n", |
457 | 447 | " <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
|
458 | 448 | " (function() {\n",
|
459 | 449 | " var plotSpec={\n",
|
|
481 | 471 | "'geom':\"contourf\"\n",
|
482 | 472 | "}]\n",
|
483 | 473 | "};\n",
|
484 |
| - " var plotContainer = document.getElementById(\"g44PRA\");\n", |
| 474 | + " var plotContainer = document.getElementById(\"fqzB2C\");\n", |
485 | 475 | " window.letsPlotCall(function() {{\n",
|
486 | 476 | " LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
|
487 | 477 | " }});\n",
|
|
490 | 480 | ]
|
491 | 481 | },
|
492 | 482 | "execution_count": 9,
|
493 |
| - "metadata": { |
494 |
| - "new_classpath": [] |
495 |
| - }, |
| 483 | + "metadata": {}, |
496 | 484 | "output_type": "execute_result"
|
497 | 485 | }
|
498 | 486 | ],
|
499 | 487 | "source": [
|
500 | 488 | "// 'contourf' geom works a lot better:\n",
|
501 |
| - "p2 + geom_contourf {z=Z; fill=\"..level..\"}" |
| 489 | + "p2 + geomContourFilled {z=Z; fill=\"..level..\"}" |
502 | 490 | ]
|
503 | 491 | }
|
504 | 492 | ],
|
|
513 | 501 | "file_extension": ".kt",
|
514 | 502 | "mimetype": "text/x-kotlin",
|
515 | 503 | "name": "kotlin",
|
| 504 | + "nbconvert_exporter": "", |
516 | 505 | "pygments_lexer": "kotlin",
|
517 |
| - "version": "1.5.0-dev-1206" |
| 506 | + "version": "1.5.20-dev-4184" |
518 | 507 | },
|
519 | 508 | "pycharm": {
|
520 | 509 | "stem_cell": {
|
|
0 commit comments