j1-template 2022.2.3 → 2022.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/assets/themes/j1/adapter/js/analytics.js +13 -13
  3. data/assets/themes/j1/adapter/js/nbinteract.js +192 -39
  4. data/assets/themes/j1/core/css/themes/unodark/bootstrap.css +30 -40
  5. data/assets/themes/j1/core/css/themes/unodark/bootstrap.min.css +1 -1
  6. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +23 -12
  7. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
  8. data/assets/themes/j1/core/js/template.js +1 -1
  9. data/assets/themes/j1/core/js/template.min.js +1 -1
  10. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  11. data/assets/themes/j1/modules/carousel/css/theme/uno.css +5 -0
  12. data/assets/themes/j1/modules/carousel/css/theme/uno.min.css +1 -1
  13. data/assets/themes/j1/modules/justifiedGallery/css/justifiedGallery.css +6 -0
  14. data/assets/themes/j1/modules/justifiedGallery/css/justifiedGallery.min.css +1 -1
  15. data/assets/themes/j1/modules/mmenuLight/css/mmenu-light.css +2 -2
  16. data/assets/themes/j1/modules/mmenuLight/css/mmenu-light.min.css +1 -2
  17. data/assets/themes/j1/modules/nbInteract/css/theme/uno/nbinteract-core.css +33 -33
  18. data/assets/themes/j1/modules/nbInteract/css/theme/uno/nbinteract-core.min.css +1 -1
  19. data/assets/themes/j1/modules/nbInteract/js/requireJS/require.js +2068 -0
  20. data/assets/themes/j1/modules/nbInteract/js/requireJS/require.min.js +36 -0
  21. data/assets/themes/j1/modules/plotly/LICENSE +21 -0
  22. data/assets/themes/j1/modules/plotly/README.md +32 -0
  23. data/assets/themes/j1/modules/plotly/js/plotly.js +265345 -0
  24. data/assets/themes/j1/modules/plotly/js/plotly.min.js +65 -0
  25. data/assets/themes/j1/modules/requirejs/LICENSE +45 -0
  26. data/assets/themes/j1/modules/requirejs/README.md +79 -0
  27. data/assets/themes/j1/modules/requirejs/js/require.js +2068 -0
  28. data/assets/themes/j1/modules/requirejs/js/require.min.js +36 -0
  29. data/lib/j1/version.rb +1 -1
  30. data/lib/starter_web/Gemfile +1 -1
  31. data/lib/starter_web/_config.yml +1 -1
  32. data/lib/starter_web/_data/modules/analytics.yml +8 -23
  33. data/lib/starter_web/_data/modules/defaults/analytics.yml +1 -1
  34. data/lib/starter_web/_data/modules/justifiedGallery.yml +14 -8
  35. data/lib/starter_web/_data/modules/navigator_menu.yml +6 -3
  36. data/lib/starter_web/_data/modules/nbinteract.yml +12 -48
  37. data/lib/starter_web/_data/resources.yml +56 -0
  38. data/lib/starter_web/_includes/attributes.asciidoc +11 -0
  39. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  40. data/lib/starter_web/assets/images/pages/nbinteract/mandelbrot-menge-1920x1200.jpg +0 -0
  41. data/lib/starter_web/assets/images/pages/nbinteract/mandelbrot-menge.png +0 -0
  42. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_bar.jpg +0 -0
  43. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_hist.jpg +0 -0
  44. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_line.jpg +0 -0
  45. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_multiple_choice.jpg +0 -0
  46. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_scatter.jpg +0 -0
  47. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_scatter_drag.jpg +0 -0
  48. data/lib/starter_web/assets/images/pages/nbinteract/manual/nbi_short_answer.jpg +0 -0
  49. data/lib/starter_web/assets/videos/gallery/kick-it-old-school-poster.jpg +0 -0
  50. data/lib/starter_web/assets/videos/gallery/nye-party-shop-poster.jpg +0 -0
  51. data/lib/starter_web/assets/videos/gallery/stay-colorful-poster.jpg +0 -0
  52. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-wiki-series.adoc +1 -0
  53. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-wiki-series.adoc +1 -0
  54. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-wiki-series.adoc +1 -0
  55. data/lib/starter_web/package.json +1 -2
  56. data/lib/starter_web/pages/public/jupyter/docs/j1-nbinteract-doc.adoc +16 -16
  57. data/lib/starter_web/pages/public/jupyter/docs/nbi-widget-manual.adoc +149 -2
  58. data/lib/starter_web/pages/public/jupyter/docs/nbinteract-doc.adoc +1 -1
  59. data/lib/starter_web/pages/public/jupyter/examples/j1-circular-times-table.adoc +137 -0
  60. data/lib/starter_web/pages/public/jupyter/examples/j1-interactive-widgets.adoc +2 -2
  61. data/lib/starter_web/pages/public/jupyter/examples/j1-odes-in-python.adoc +11 -6
  62. data/lib/starter_web/pages/public/jupyter/examples/j1-testing-plotly.adoc +86 -0
  63. data/lib/starter_web/pages/public/jupyter/examples/j1_climate-change-forecast.adoc +2 -2
  64. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast-checkpoint.ipynb +1058 -0
  65. data/lib/starter_web/pages/public/jupyter/notebooks/j1/{j1_ode_selected.ipynb → .ipynb_checkpoints/j1_docs_example_dynamic-checkpoint.ipynb} +1 -1
  66. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive_widgets-checkpoint.ipynb +20 -20
  67. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/{j1_altair_interactive_test-checkpoint.ipynb → j1_ode_selected-checkpoint.ipynb} +99 -318
  68. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_odes_in_python-checkpoint.ipynb +15227 -0
  69. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_circular_times_table.ipynb +12390 -0
  70. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_climate_change_forecast.ipynb +2 -2
  71. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_docs_example_dynamic.ipynb +1 -1
  72. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_interactive_widgets.ipynb +20 -20
  73. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_odes_in_python.ipynb +15227 -0
  74. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_variability_of_the_sample_mean-checkpoint.ipynb +323 -0
  75. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +387 -0
  76. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_layout-checkpoint.ipynb +384 -0
  77. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_tutorial_interact-checkpoint.ipynb +254 -0
  78. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_tutorial_monty_hall-checkpoint.ipynb +732 -0
  79. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/nbi_docs_tutorial_monty_hall.ipynb +25 -26
  80. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_circular_times_table.html +749 -0
  81. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_climate_change_forecast.html +2 -2
  82. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_docs_example_dynamic.html +186 -186
  83. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_interactive_widgets.html +919 -919
  84. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_odes_in_python.html +955 -0
  85. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/nbi_docs_recipes_interactive_questions.html +242 -242
  86. data/lib/starter_web/pages/public/jupyter/services/binderhub.adoc +3 -3
  87. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +1 -1
  88. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +9 -15
  89. data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +1 -1
  90. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +1 -1
  91. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +1 -1
  92. data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +1 -1
  93. data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +1 -1
  94. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +117 -12
  95. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  96. data/lib/starter_web/utilsrv/package.json +1 -1
  97. metadata +38 -22
  98. data/lib/starter_web/assets/videos/gallery/adriana-lima-poster.jpg +0 -0
  99. data/lib/starter_web/pages/public/jupyter/notebooks/binder/binder-launches.ipynb +0 -385
  100. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -6
  101. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/binder-launches-checkpoint.ipynb +0 -385
  102. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/google_altair-checkpoint.ipynb +0 -33
  103. data/lib/starter_web/pages/public/jupyter/notebooks/j1/binder-launches.ipynb +0 -411
  104. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/binder-launches.html +0 -670
  105. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_ode_selected.html +0 -186
  106. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/excel.py +0 -55
  107. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/ggplot.py +0 -108
  108. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/ggplot2.py +0 -108
  109. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/husky.py +0 -121
  110. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/latimes.py +0 -149
  111. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/pcolor.py +0 -6
  112. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/quartz.py +0 -55
  113. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/spacy_base.py +0 -94
  114. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/spacy_mono.py +0 -158
  115. data/lib/starter_web/pages/public/jupyter/notebooks/themes/altair/sunsentinel.py +0 -125
@@ -9,12 +9,12 @@
9
9
  }
10
10
  },
11
11
  "source": [
12
- "### Resources"
12
+ "#### Resources"
13
13
  ]
14
14
  },
15
15
  {
16
16
  "cell_type": "code",
17
- "execution_count": 54,
17
+ "execution_count": 1,
18
18
  "metadata": {
19
19
  "ExecuteTime": {
20
20
  "end_time": "2017-08-15T00:19:29.880777Z",
@@ -26,362 +26,143 @@
26
26
  "import warnings\n",
27
27
  "warnings.filterwarnings(\"ignore\")\n",
28
28
  "\n",
29
- "import pandas as pd\n",
29
+ "### General Purpose\n",
30
30
  "import numpy as np\n",
31
- "import altair as alt\n",
31
+ "from matplotlib import pyplot as plt\n",
32
+ "from scipy.integrate import odeint\n",
32
33
  "\n",
33
- "import ipywidgets as widgets\n",
34
- "from ipywidgets import interact\n",
34
+ "### Jupyter Specifics\n",
35
+ "from IPython.display import HTML\n",
36
+ "from ipywidgets.widgets import interact, IntSlider, FloatSlider, Layout\n",
35
37
  "\n",
36
- "from IPython.display import HTML\n"
37
- ]
38
- },
39
- {
40
- "cell_type": "markdown",
41
- "metadata": {},
42
- "source": [
43
- "### Load Vega Datasets\n",
38
+ "%matplotlib inline\n",
44
39
  "\n",
45
- "To list all the available datsets, use list_datasets:"
46
- ]
47
- },
48
- {
49
- "cell_type": "code",
50
- "execution_count": 55,
51
- "metadata": {},
52
- "outputs": [],
53
- "source": [
54
- "from vega_datasets import data"
55
- ]
56
- },
57
- {
58
- "cell_type": "markdown",
59
- "metadata": {},
60
- "source": [
61
- "### Load Theme\n"
62
- ]
63
- },
64
- {
65
- "cell_type": "code",
66
- "execution_count": 68,
67
- "metadata": {},
68
- "outputs": [],
69
- "source": [
70
- "# See: https://stackoverflow.com/questions/21034373/how-to-load-edit-run-save-text-files-py-into-an-ipython-notebook-cell\n",
71
- "%load ../themes/altair/theme_ggplot.py\n",
72
- "\n"
73
- ]
74
- },
75
- {
76
- "cell_type": "markdown",
77
- "metadata": {},
78
- "source": [
79
- "### Register Theme"
80
- ]
81
- },
82
- {
83
- "cell_type": "code",
84
- "execution_count": 69,
85
- "metadata": {},
86
- "outputs": [
87
- {
88
- "data": {
89
- "text/plain": [
90
- "ThemeRegistry.enable('theme_ggplot')"
91
- ]
92
- },
93
- "execution_count": 69,
94
- "metadata": {},
95
- "output_type": "execute_result"
96
- }
97
- ],
98
- "source": [
99
- "alt.themes.register(\"theme_ggplot\", theme_ggplot)\n",
100
- "alt.themes.enable(\"theme_ggplot\")"
40
+ "style = {'description_width': '150px'}\n",
41
+ "slider_layout = Layout(width='99%')"
101
42
  ]
102
43
  },
103
44
  {
104
45
  "cell_type": "markdown",
105
46
  "metadata": {},
106
47
  "source": [
107
- "### Building Complex Selections\n",
108
- "\n",
109
- "Selection values can be accessed directly and used in expressions that affect the chart. For example, here we create a slider to choose a cutoff value, and color points based on whether they are smaller or larger than the value:"
48
+ "#### Calculation"
110
49
  ]
111
50
  },
112
51
  {
113
52
  "cell_type": "code",
114
- "execution_count": 70,
115
- "metadata": {},
116
- "outputs": [
117
- {
118
- "data": {
119
- "text/html": [
120
- "\n",
121
- "<div id=\"altair-viz-1b202d8be5a44618bb456f08a9464178\"></div>\n",
122
- "<script type=\"text/javascript\">\n",
123
- " var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n",
124
- " (function(spec, embedOpt){\n",
125
- " let outputDiv = document.currentScript.previousElementSibling;\n",
126
- " if (outputDiv.id !== \"altair-viz-1b202d8be5a44618bb456f08a9464178\") {\n",
127
- " outputDiv = document.getElementById(\"altair-viz-1b202d8be5a44618bb456f08a9464178\");\n",
128
- " }\n",
129
- " const paths = {\n",
130
- " \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
131
- " \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
132
- " \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.17.0?noext\",\n",
133
- " \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
134
- " };\n",
135
- "\n",
136
- " function maybeLoadScript(lib, version) {\n",
137
- " var key = `${lib.replace(\"-\", \"\")}_version`;\n",
138
- " return (VEGA_DEBUG[key] == version) ?\n",
139
- " Promise.resolve(paths[lib]) :\n",
140
- " new Promise(function(resolve, reject) {\n",
141
- " var s = document.createElement('script');\n",
142
- " document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
143
- " s.async = true;\n",
144
- " s.onload = () => {\n",
145
- " VEGA_DEBUG[key] = version;\n",
146
- " return resolve(paths[lib]);\n",
147
- " };\n",
148
- " s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
149
- " s.src = paths[lib];\n",
150
- " });\n",
151
- " }\n",
152
- "\n",
153
- " function showError(err) {\n",
154
- " outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
155
- " throw err;\n",
156
- " }\n",
157
- "\n",
158
- " function displayChart(vegaEmbed) {\n",
159
- " vegaEmbed(outputDiv, spec, embedOpt)\n",
160
- " .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
161
- " }\n",
162
- "\n",
163
- " if(typeof define === \"function\" && define.amd) {\n",
164
- " requirejs.config({paths});\n",
165
- " require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
166
- " } else {\n",
167
- " maybeLoadScript(\"vega\", \"5\")\n",
168
- " .then(() => maybeLoadScript(\"vega-lite\", \"4.17.0\"))\n",
169
- " .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n",
170
- " .catch(showError)\n",
171
- " .then(() => displayChart(vegaEmbed));\n",
172
- " }\n",
173
- " })({\"config\": {\"view\": {\"fill\": \"#f0f2f6\"}, \"arc\": {\"fill\": \"#F63366\"}, \"area\": {\"fill\": \"#F63366\"}, \"circle\": {\"fill\": \"#F63366\", \"stroke\": \"#262730\", \"strokeWidth\": 0.5}, \"line\": {\"stroke\": \"#F63366\"}, \"path\": {\"stroke\": \"#F63366\"}, \"point\": {\"stroke\": \"#F63366\"}, \"rect\": {\"fill\": \"#F63366\"}, \"shape\": {\"stroke\": \"#F63366\"}, \"symbol\": {\"fill\": \"#F63366\"}, \"title\": {\"font\": \"IBM Plex Mono\", \"color\": \"#262730\", \"fontSize\": 20.0, \"anchor\": \"start\"}, \"axis\": {\"titleFont\": \"IBM Plex Mono\", \"titleColor\": \"#262730\", \"titleFontSize\": 12.8, \"labelFont\": \"IBM Plex Mono\", \"labelColor\": \"#262730\", \"labelFontSize\": 12.8, \"grid\": true, \"gridColor\": \"#fff\", \"gridOpacity\": 1, \"domain\": false, \"tickColor\": \"#262730\"}, \"header\": {\"labelFont\": \"IBM Plex Mono\", \"titleFont\": \"IBM Plex Mono\", \"labelFontSize\": 16, \"titleFontSize\": 16}, \"legend\": {\"titleFont\": \"IBM Plex Mono\", \"titleColor\": \"#262730\", \"titleFontSize\": 12.8, \"labelFont\": \"IBM Plex Mono\", \"labelColor\": \"#262730\", \"labelFontSize\": 12.8}, \"range\": {\"category\": [\"#f63366\", \"#fffd80\", \"#0068c9\", \"#ff2b2b\", \"#09ab3b\"], \"diverging\": [\"#850018\", \"#cd1549\", \"#f6618d\", \"#fbafc4\", \"#f5f5f5\", \"#93c5fe\", \"#5091e6\", \"#1d5ebd\", \"#002f84\"], \"heatmap\": [\"#ffb5d4\", \"#ff97b8\", \"#ff7499\", \"#fc4c78\", \"#ec245f\", \"#d2004b\", \"#b10034\", \"#91001f\", \"#720008\"], \"ramp\": [\"#ffb5d4\", \"#ff97b8\", \"#ff7499\", \"#fc4c78\", \"#ec245f\", \"#d2004b\", \"#b10034\", \"#91001f\", \"#720008\"], \"ordinal\": [\"#ffb5d4\", \"#ff97b8\", \"#ff7499\", \"#fc4c78\", \"#ec245f\", \"#d2004b\", \"#b10034\", \"#91001f\", \"#720008\"]}}, \"data\": {\"name\": \"data-a99664901d810a6b330d8e4930eed708\"}, \"mark\": \"point\", \"encoding\": {\"color\": {\"condition\": {\"value\": \"red\", \"test\": \"(datum.xval < SelectorName.cutoff)\"}, \"value\": \"blue\"}, \"x\": {\"field\": \"xval\", \"type\": \"quantitative\"}, \"y\": {\"field\": \"yval\", \"type\": \"quantitative\"}}, \"selection\": {\"SelectorName\": {\"type\": \"single\", \"fields\": [\"cutoff\"], \"bind\": {\"input\": \"range\", \"max\": 100, \"min\": 0, \"name\": \"CutOff:\", \"step\": 1}, \"init\": {\"cutoff\": 50}}, \"selector011\": {\"type\": \"interval\", \"bind\": \"scales\", \"encodings\": [\"x\", \"y\"]}}, \"width\": 1024, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.17.0.json\", \"datasets\": {\"data-a99664901d810a6b330d8e4930eed708\": [{\"xval\": 0, \"yval\": 0.4967141530112327}, {\"xval\": 1, \"yval\": 0.358449851840048}, {\"xval\": 2, \"yval\": 1.0061383899407406}, {\"xval\": 3, \"yval\": 2.5291682463487657}, {\"xval\": 4, \"yval\": 2.2950148716254297}, {\"xval\": 5, \"yval\": 2.060877914676249}, {\"xval\": 6, \"yval\": 3.6400907301836405}, {\"xval\": 7, \"yval\": 4.407525459336549}, {\"xval\": 8, \"yval\": 3.938051073401597}, {\"xval\": 9, \"yval\": 4.4806111169875615}, {\"xval\": 10, \"yval\": 4.017193424175099}, {\"xval\": 11, \"yval\": 3.5514636706048424}, {\"xval\": 12, \"yval\": 3.7934259421708765}, {\"xval\": 13, \"yval\": 1.8801456975130786}, {\"xval\": 14, \"yval\": 0.15522786500004582}, {\"xval\": 15, \"yval\": -0.4070596642409269}, {\"xval\": 16, \"yval\": -1.4198907845753506}, {\"xval\": 17, \"yval\": -1.1056434519800766}, {\"xval\": 18, \"yval\": -2.0136675275012874}, {\"xval\": 19, \"yval\": -3.4259712288365787}, {\"xval\": 20, \"yval\": -1.9603224599150246}, {\"xval\": 21, \"yval\": -2.1860987604015603}, {\"xval\": 22, \"yval\": -2.1185705557136365}, {\"xval\": 23, \"yval\": -3.5433187419270933}, {\"xval\": 24, \"yval\": -4.087701466452276}, {\"xval\": 25, \"yval\": -3.9767788767424097}, {\"xval\": 26, \"yval\": -5.127772454164712}, {\"xval\": 27, \"yval\": -4.75207443581904}, {\"xval\": 28, \"yval\": -5.352713125737845}, {\"xval\": 29, \"yval\": -5.644406875531121}, {\"xval\": 30, \"yval\": -6.2461134877605184}, {\"xval\": 31, \"yval\": -4.3938353032515804}, {\"xval\": 32, \"yval\": -4.407332527989515}, {\"xval\": 33, \"yval\": -5.4650434569454145}, {\"xval\": 34, \"yval\": -4.642498544842225}, {\"xval\": 35, \"yval\": -5.863342194813248}, {\"xval\": 36, \"yval\": -5.654478599808492}, {\"xval\": 37, \"yval\": -7.614148723688268}, {\"xval\": 38, \"yval\": -8.942334772586698}, {\"xval\": 39, \"yval\": -8.745473536717574}, {\"xval\": 40, \"yval\": -8.007006956722163}, {\"xval\": 41, \"yval\": -7.835638675532193}, {\"xval\": 42, \"yval\": -7.951286957920433}, {\"xval\": 43, \"yval\": -8.252390653509723}, {\"xval\": 44, \"yval\": -9.73091264387715}, {\"xval\": 45, \"yval\": -10.450756852271859}, {\"xval\": 46, \"yval\": -10.911395623231646}, {\"xval\": 47, \"yval\": -9.854273397012731}, {\"xval\": 48, \"yval\": -9.51065510744427}, {\"xval\": 49, \"yval\": -11.273695262807005}, {\"xval\": 50, \"yval\": -10.94961129341221}, {\"xval\": 51, \"yval\": -11.334693573828526}, {\"xval\": 52, \"yval\": -12.011615574134485}, {\"xval\": 53, \"yval\": -11.399939285293616}, {\"xval\": 54, \"yval\": -10.368939762797666}, {\"xval\": 55, \"yval\": -9.437659643681467}, {\"xval\": 56, \"yval\": -10.276877166904105}, {\"xval\": 57, \"yval\": -10.58608954275532}, {\"xval\": 58, \"yval\": -10.254826111351756}, {\"xval\": 59, \"yval\": -9.279280984229397}, {\"xval\": 60, \"yval\": -9.758455222074687}, {\"xval\": 61, \"yval\": -9.944114198738504}, {\"xval\": 62, \"yval\": -11.050449172744532}, {\"xval\": 63, \"yval\": -12.246655796825202}, {\"xval\": 64, \"yval\": -11.434129974431004}, {\"xval\": 65, \"yval\": -10.07788994586018}, {\"xval\": 66, \"yval\": -10.149900067440514}, {\"xval\": 67, \"yval\": -9.14636716954849}, {\"xval\": 68, \"yval\": -8.784731144500856}, {\"xval\": 69, \"yval\": -9.42985089910598}, {\"xval\": 70, \"yval\": -9.068455293597568}, {\"xval\": 71, \"yval\": -7.5304187271315985}, {\"xval\": 72, \"yval\": -7.56624476624155}, {\"xval\": 73, \"yval\": -6.001601110427544}, {\"xval\": 74, \"yval\": -8.621346214517288}, {\"xval\": 75, \"yval\": -7.799443710142064}, {\"xval\": 76, \"yval\": -7.712396641903893}, {\"xval\": 77, \"yval\": -8.011403992369761}, {\"xval\": 78, \"yval\": -7.919643215834259}, {\"xval\": 79, \"yval\": -9.907212130435152}, {\"xval\": 80, \"yval\": -10.126884018272664}, {\"xval\": 81, \"yval\": -9.769771446760917}, {\"xval\": 82, \"yval\": -8.2918774020194}, {\"xval\": 83, \"yval\": -8.810147620293048}, {\"xval\": 84, \"yval\": -9.618641223186236}, {\"xval\": 85, \"yval\": -10.120398266770772}, {\"xval\": 86, \"yval\": -9.204996149068698}, {\"xval\": 87, \"yval\": -8.876245039409014}, {\"xval\": 88, \"yval\": -9.406005243176052}, {\"xval\": 89, \"yval\": -8.892737810062696}, {\"xval\": 90, \"yval\": -8.795660260714657}, {\"xval\": 91, \"yval\": -7.827015270181768}, {\"xval\": 92, \"yval\": -8.529068364059121}, {\"xval\": 93, \"yval\": -8.85673051065689}, {\"xval\": 94, \"yval\": -9.248838663789048}, {\"xval\": 95, \"yval\": -10.712353611921166}, {\"xval\": 96, \"yval\": -10.41623333485659}, {\"xval\": 97, \"yval\": -10.1551780626767}, {\"xval\": 98, \"yval\": -10.15006460603424}, {\"xval\": 99, \"yval\": -10.384651739409387}]}}, {\"mode\": \"vega-lite\"});\n",
174
- "</script>"
175
- ],
176
- "text/plain": [
177
- "alt.Chart(...)"
178
- ]
179
- },
180
- "execution_count": 70,
181
- "metadata": {},
182
- "output_type": "execute_result"
53
+ "execution_count": 2,
54
+ "metadata": {
55
+ "ExecuteTime": {
56
+ "end_time": "2017-08-15T00:19:30.835126Z",
57
+ "start_time": "2017-08-15T00:19:29.885794Z"
183
58
  }
184
- ],
59
+ },
60
+ "outputs": [],
185
61
  "source": [
186
- "# nbi:hide_in\n",
187
- "rand = np.random.RandomState(42)\n",
62
+ "def main(rabbits_birthrate, rabbits_deathrate, foxes_birthrate,\n",
63
+ " foxes_deathrate, initial_rabbits, foxes_inicial, days):\n",
188
64
  "\n",
189
- "df = pd.DataFrame({\n",
190
- " 'xval': range(100),\n",
191
- " 'yval': rand.randn(100).cumsum()\n",
192
- "})\n",
65
+ " def function(s, t):\n",
66
+ " x, y = s\n",
67
+ " dydt = [\n",
68
+ " rabbits_birthrate * x - rabbits_deathrate * x * y, # dx/dy -> Change in Rabbits\n",
69
+ " foxes_birthrate * x * y - foxes_deathrate * y # dy/dt -> Change in Foxes\n",
70
+ " ]\n",
71
+ " \n",
72
+ " return dydt\n",
73
+ " \n",
74
+ " time = np.arange(0, days, 0.01)\n",
75
+ " initial_conditions = [initial_rabbits, foxes_inicial]\n",
76
+ " solution = odeint(function, initial_conditions, time)\n",
193
77
  "\n",
194
- "slider = alt.binding_range(min=0, max=100, step=1, name='CutOff:')\n",
195
- "selector = alt.selection_single(\n",
196
- " name=\"SelectorName\", fields=['cutoff'],\n",
197
- " bind=slider, init={'cutoff': 50})\n",
78
+ " #Graphic details\n",
79
+ " fig, axes = plt.subplots(1, 2, figsize=(15, 10))\n",
80
+ " \n",
81
+ " ax = axes[0]\n",
82
+ " \n",
83
+ " ax.plot(time, solution[:, 0], label='Rabbits(t)')\n",
84
+ " ax.plot(time, solution[:, 1], label='Foxes(t)')\n",
85
+ " \n",
86
+ " if days <= 30:\n",
87
+ " step = 1\n",
88
+ " rotation = \"horizontal\"\n",
89
+ " elif days <= 150:\n",
90
+ " step = 5\n",
91
+ " rotation = \"vertical\"\n",
92
+ " else:\n",
93
+ " step = 10\n",
94
+ " rotation = \"vertical\"\n",
95
+ " \n",
96
+ " ax.set_xticklabels(np.arange(0, days + 1, step, dtype=int), rotation=rotation)\n",
97
+ " ax.set_xticks(np.arange(0, days + 1, step))\n",
98
+ " \n",
99
+ " ax.set_xlim([0, days])\n",
100
+ " ax.set_ylim([0, max(max(solution[:, 0]), max(solution[:, 1])) * 1.05])\n",
101
+ " ax.set_xlabel('Time')\n",
102
+ " ax.set_ylabel('Population')\n",
103
+ " ax.legend(loc='best')\n",
104
+ " ax.grid()\n",
105
+ " \n",
106
+ " \n",
107
+ " ax = axes[1]\n",
108
+ " \n",
109
+ " ax.plot(solution[:, 0], solution[:, 1], label='Foxes vs Rabbits')\n",
198
110
  "\n",
199
- "alt.Chart(df).mark_point().encode(\n",
200
- " x='xval',\n",
201
- " y='yval',\n",
202
- " color=alt.condition(\n",
203
- " alt.datum.xval < selector.cutoff,\n",
204
- " alt.value('red'), alt.value('blue')\n",
205
- " )\n",
206
- ").add_selection(\n",
207
- " selector\n",
208
- ").interactive().properties(width=1024)\n"
111
+ " ax.set_xlim([0, max(solution[:, 0]) * 1.05])\n",
112
+ " ax.set_ylim([0, max(solution[:, 1]) * 1.05])\n",
113
+ " ax.set_xlabel('Rabbits')\n",
114
+ " ax.set_ylabel('Foxes')\n",
115
+ " ax.legend(loc='best')\n",
116
+ " ax.grid()\n",
117
+ " \n",
118
+ " plt.tight_layout()\n",
119
+ " plt.show()"
209
120
  ]
210
121
  },
211
122
  {
212
123
  "cell_type": "markdown",
213
124
  "metadata": {},
214
125
  "source": [
215
- "#### Multiple Interactions\n",
216
- "\n",
217
- "This example shows how multiple user inputs can be layered onto a chart. The four inputs have functionality as follows:\n",
218
- "\n",
219
- "* Dropdown: Filters the movies by genre\n",
220
- "* Radio Buttons: Highlights certain films by Worldwide Gross\n",
221
- "* Mouse Drag and Scroll: Zooms the x and y scales to allow for panning.\n",
222
- "\n"
126
+ "#### Evaluation"
223
127
  ]
224
128
  },
225
129
  {
226
130
  "cell_type": "code",
227
- "execution_count": 71,
131
+ "execution_count": 3,
228
132
  "metadata": {},
229
133
  "outputs": [
230
134
  {
231
135
  "data": {
232
- "text/html": [
233
- "\n",
234
- "<div id=\"altair-viz-acd9e9c4a68a497f9c1777981b7664c5\"></div>\n",
235
- "<script type=\"text/javascript\">\n",
236
- " var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n",
237
- " (function(spec, embedOpt){\n",
238
- " let outputDiv = document.currentScript.previousElementSibling;\n",
239
- " if (outputDiv.id !== \"altair-viz-acd9e9c4a68a497f9c1777981b7664c5\") {\n",
240
- " outputDiv = document.getElementById(\"altair-viz-acd9e9c4a68a497f9c1777981b7664c5\");\n",
241
- " }\n",
242
- " const paths = {\n",
243
- " \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
244
- " \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
245
- " \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.17.0?noext\",\n",
246
- " \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
247
- " };\n",
248
- "\n",
249
- " function maybeLoadScript(lib, version) {\n",
250
- " var key = `${lib.replace(\"-\", \"\")}_version`;\n",
251
- " return (VEGA_DEBUG[key] == version) ?\n",
252
- " Promise.resolve(paths[lib]) :\n",
253
- " new Promise(function(resolve, reject) {\n",
254
- " var s = document.createElement('script');\n",
255
- " document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
256
- " s.async = true;\n",
257
- " s.onload = () => {\n",
258
- " VEGA_DEBUG[key] = version;\n",
259
- " return resolve(paths[lib]);\n",
260
- " };\n",
261
- " s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
262
- " s.src = paths[lib];\n",
263
- " });\n",
264
- " }\n",
265
- "\n",
266
- " function showError(err) {\n",
267
- " outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
268
- " throw err;\n",
269
- " }\n",
270
- "\n",
271
- " function displayChart(vegaEmbed) {\n",
272
- " vegaEmbed(outputDiv, spec, embedOpt)\n",
273
- " .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
274
- " }\n",
275
- "\n",
276
- " if(typeof define === \"function\" && define.amd) {\n",
277
- " requirejs.config({paths});\n",
278
- " require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
279
- " } else {\n",
280
- " maybeLoadScript(\"vega\", \"5\")\n",
281
- " .then(() => maybeLoadScript(\"vega-lite\", \"4.17.0\"))\n",
282
- " .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n",
283
- " .catch(showError)\n",
284
- " .then(() => displayChart(vegaEmbed));\n",
285
- " }\n",
286
- " })({\"config\": {\"view\": {\"fill\": \"#f0f2f6\"}, \"arc\": {\"fill\": \"#F63366\"}, \"area\": {\"fill\": \"#F63366\"}, \"circle\": {\"fill\": \"#F63366\", \"stroke\": \"#262730\", \"strokeWidth\": 0.5}, \"line\": {\"stroke\": \"#F63366\"}, \"path\": {\"stroke\": \"#F63366\"}, \"point\": {\"stroke\": \"#F63366\"}, \"rect\": {\"fill\": \"#F63366\"}, \"shape\": {\"stroke\": \"#F63366\"}, \"symbol\": {\"fill\": \"#F63366\"}, \"title\": {\"font\": \"IBM Plex Mono\", \"color\": \"#262730\", \"fontSize\": 20.0, \"anchor\": \"start\"}, \"axis\": {\"titleFont\": \"IBM Plex Mono\", \"titleColor\": \"#262730\", \"titleFontSize\": 12.8, \"labelFont\": \"IBM Plex Mono\", \"labelColor\": \"#262730\", \"labelFontSize\": 12.8, \"grid\": true, \"gridColor\": \"#fff\", \"gridOpacity\": 1, \"domain\": false, \"tickColor\": \"#262730\"}, \"header\": {\"labelFont\": \"IBM Plex Mono\", \"titleFont\": \"IBM Plex Mono\", \"labelFontSize\": 16, \"titleFontSize\": 16}, \"legend\": {\"titleFont\": \"IBM Plex Mono\", \"titleColor\": \"#262730\", \"titleFontSize\": 12.8, \"labelFont\": \"IBM Plex Mono\", \"labelColor\": \"#262730\", \"labelFontSize\": 12.8}, \"range\": {\"category\": [\"#f63366\", \"#fffd80\", \"#0068c9\", \"#ff2b2b\", \"#09ab3b\"], \"diverging\": [\"#850018\", \"#cd1549\", \"#f6618d\", \"#fbafc4\", \"#f5f5f5\", \"#93c5fe\", \"#5091e6\", \"#1d5ebd\", \"#002f84\"], \"heatmap\": [\"#ffb5d4\", \"#ff97b8\", \"#ff7499\", \"#fc4c78\", \"#ec245f\", \"#d2004b\", \"#b10034\", \"#91001f\", \"#720008\"], \"ramp\": [\"#ffb5d4\", \"#ff97b8\", \"#ff7499\", \"#fc4c78\", \"#ec245f\", \"#d2004b\", \"#b10034\", \"#91001f\", \"#720008\"], \"ordinal\": [\"#ffb5d4\", \"#ff97b8\", \"#ff7499\", \"#fc4c78\", \"#ec245f\", \"#d2004b\", \"#b10034\", \"#91001f\", \"#720008\"]}}, \"vconcat\": [{\"hconcat\": [{\"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"tooltip\": {\"field\": \"Title\", \"type\": \"nominal\"}, \"x\": {\"field\": \"Worldwide_Gross\", \"scale\": {\"clamp\": true, \"domain\": [100000, 1000000000]}, \"type\": \"quantitative\"}, \"y\": {\"field\": \"IMDB_Rating\", \"type\": \"quantitative\"}}, \"height\": 200, \"selection\": {\"Release Year_\": {\"type\": \"single\", \"bind\": {\"input\": \"range\", \"max\": 2018, \"min\": 1969, \"step\": 1}, \"fields\": [\"Release_Year\"]}}, \"title\": \"Slider Filtering\", \"transform\": [{\"calculate\": \"floor(datum.IMDB_Rating)\", \"as\": \"Rounded_IMDB_Rating\"}, {\"calculate\": \"datum.Production_Budget > 100000000.0 ? 100 : 10\", \"as\": \"Hundred_Million_Production\"}, {\"calculate\": \"year(datum.Release_Date)\", \"as\": \"Release_Year\"}, {\"filter\": \"(datum.IMDB_Rating > 0)\"}, {\"filter\": {\"field\": \"MPAA_Rating\", \"oneOf\": [\"G\", \"NC-17\", \"PG\", \"PG-13\", \"R\"]}}, {\"filter\": {\"selection\": \"Release Year_\"}}], \"width\": 200}, {\"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"tooltip\": {\"field\": \"Title\", \"type\": \"nominal\"}, \"x\": {\"field\": \"Worldwide_Gross\", \"scale\": {\"clamp\": true, \"domain\": [100000, 1000000000]}, \"type\": \"quantitative\"}, \"y\": {\"field\": \"IMDB_Rating\", \"type\": \"quantitative\"}}, \"height\": 200, \"selection\": {\"Genre\": {\"type\": \"single\", \"fields\": [\"Major_Genre\"], \"bind\": {\"input\": \"select\", \"options\": [\"Action\", \"Adventure\", \"Black Comedy\", \"Comedy\", \"Concert/Performance\", \"Documentary\", \"Drama\", \"Horror\", \"Musical\", \"Romantic Comedy\", \"Thriller/Suspense\", \"Western\"]}}}, \"title\": \"Dropdown Filtering\", \"transform\": [{\"calculate\": \"floor(datum.IMDB_Rating)\", \"as\": \"Rounded_IMDB_Rating\"}, {\"calculate\": \"datum.Production_Budget > 100000000.0 ? 100 : 10\", \"as\": \"Hundred_Million_Production\"}, {\"calculate\": \"year(datum.Release_Date)\", \"as\": \"Release_Year\"}, {\"filter\": \"(datum.IMDB_Rating > 0)\"}, {\"filter\": {\"field\": \"MPAA_Rating\", \"oneOf\": [\"G\", \"NC-17\", \"PG\", \"PG-13\", \"R\"]}}, {\"filter\": {\"selection\": \"Genre\"}}], \"width\": 200}]}, {\"hconcat\": [{\"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"color\": {\"condition\": {\"field\": \"MPAA_Rating\", \"legend\": null, \"type\": \"nominal\", \"selection\": \"Rating\"}, \"value\": \"lightgray\"}, \"tooltip\": {\"field\": \"Title\", \"type\": \"nominal\"}, \"x\": {\"field\": \"Worldwide_Gross\", \"scale\": {\"clamp\": true, \"domain\": [100000, 1000000000]}, \"type\": \"quantitative\"}, \"y\": {\"field\": \"IMDB_Rating\", \"type\": \"quantitative\"}}, \"height\": 200, \"selection\": {\"Rating\": {\"type\": \"single\", \"fields\": [\"MPAA_Rating\"], \"bind\": {\"input\": \"radio\", \"options\": [\"G\", \"NC-17\", \"PG\", \"PG-13\", \"R\"]}}}, \"title\": \"Radio Button Highlighting\", \"transform\": [{\"calculate\": \"floor(datum.IMDB_Rating)\", \"as\": \"Rounded_IMDB_Rating\"}, {\"calculate\": \"datum.Production_Budget > 100000000.0 ? 100 : 10\", \"as\": \"Hundred_Million_Production\"}, {\"calculate\": \"year(datum.Release_Date)\", \"as\": \"Release_Year\"}, {\"filter\": \"(datum.IMDB_Rating > 0)\"}, {\"filter\": {\"field\": \"MPAA_Rating\", \"oneOf\": [\"G\", \"NC-17\", \"PG\", \"PG-13\", \"R\"]}}], \"width\": 200}, {\"mark\": {\"type\": \"point\", \"filled\": true}, \"encoding\": {\"size\": {\"condition\": {\"value\": 25, \"selection\": \"Budget Films\"}, \"field\": \"Hundred_Million_Production\", \"type\": \"quantitative\"}, \"tooltip\": {\"field\": \"Title\", \"type\": \"nominal\"}, \"x\": {\"field\": \"Worldwide_Gross\", \"scale\": {\"clamp\": true, \"domain\": [100000, 1000000000]}, \"type\": \"quantitative\"}, \"y\": {\"field\": \"IMDB_Rating\", \"type\": \"quantitative\"}}, \"height\": 200, \"selection\": {\"Budget Films\": {\"type\": \"single\", \"bind\": {\"input\": \"checkbox\"}}}, \"title\": \"Checkbox Formatting\", \"transform\": [{\"calculate\": \"floor(datum.IMDB_Rating)\", \"as\": \"Rounded_IMDB_Rating\"}, {\"calculate\": \"datum.Production_Budget > 100000000.0 ? 100 : 10\", \"as\": \"Hundred_Million_Production\"}, {\"calculate\": \"year(datum.Release_Date)\", \"as\": \"Release_Year\"}, {\"filter\": \"(datum.IMDB_Rating > 0)\"}, {\"filter\": {\"field\": \"MPAA_Rating\", \"oneOf\": [\"G\", \"NC-17\", \"PG\", \"PG-13\", \"R\"]}}], \"width\": 200}]}], \"data\": {\"url\": \"https://cdn.jsdelivr.net/npm/vega-datasets@v1.29.0/data/movies.json\", \"format\": {\"parse\": {\"Release_Date\": \"date\"}}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.17.0.json\"}, {\"mode\": \"vega-lite\"});\n",
287
- "</script>"
288
- ],
136
+ "application/vnd.jupyter.widget-view+json": {
137
+ "model_id": "d630678e7e9046dd8654f6b3659b823b",
138
+ "version_major": 2,
139
+ "version_minor": 0
140
+ },
289
141
  "text/plain": [
290
- "alt.VConcatChart(...)"
142
+ "interactive(children=(FloatSlider(value=1.0, description='Birth Rate/Rabbits', layout=Layout(width='99%'), max…"
291
143
  ]
292
144
  },
293
- "execution_count": 71,
294
145
  "metadata": {},
295
- "output_type": "execute_result"
146
+ "output_type": "display_data"
296
147
  }
297
148
  ],
298
149
  "source": [
299
- "movies = alt.UrlData(\n",
300
- " data.movies.url,\n",
301
- " format=alt.DataFormat(parse={\"Release_Date\":\"date\"})\n",
302
- ")\n",
303
- "ratings = ['G', 'NC-17', 'PG', 'PG-13', 'R']\n",
304
- "genres = ['Action', 'Adventure', 'Black Comedy', 'Comedy',\n",
305
- " 'Concert/Performance', 'Documentary', 'Drama', 'Horror', 'Musical',\n",
306
- " 'Romantic Comedy', 'Thriller/Suspense', 'Western']\n",
307
- "\n",
308
- "labels = ['All', 'Action', 'Adventure', 'Black Comedy', 'Comedy',\n",
309
- " 'Concert/Performance', 'Documentary', 'Drama', 'Horror', 'Musical',\n",
310
- " 'Romantic Comedy', 'Thriller/Suspense', 'Western']\n",
311
- "\n",
312
- "base = alt.Chart(movies, width=200, height=200).mark_point(filled=True).transform_calculate(\n",
313
- " Rounded_IMDB_Rating = \"floor(datum.IMDB_Rating)\",\n",
314
- " Hundred_Million_Production = \"datum.Production_Budget > 100000000.0 ? 100 : 10\",\n",
315
- " Release_Year = \"year(datum.Release_Date)\"\n",
316
- ").transform_filter(\n",
317
- " alt.datum.IMDB_Rating > 0\n",
318
- ").transform_filter(\n",
319
- " alt.FieldOneOfPredicate(field='MPAA_Rating', oneOf=ratings)\n",
320
- ").encode(\n",
321
- " x=alt.X('Worldwide_Gross:Q', scale=alt.Scale(domain=(100000,10**9), clamp=True)),\n",
322
- " y='IMDB_Rating:Q',\n",
323
- " tooltip=\"Title:N\"\n",
324
- ")\n",
325
- "\n",
326
- "# A slider filter\n",
327
- "year_slider = alt.binding_range(min=1969, max=2018, step=1)\n",
328
- "slider_selection = alt.selection_single(bind=year_slider, fields=['Release_Year'], name=\"Release Year_\")\n",
329
- "\n",
330
- "\n",
331
- "filter_year = base.add_selection(\n",
332
- " slider_selection\n",
333
- ").transform_filter(\n",
334
- " slider_selection\n",
335
- ").properties(title=\"Slider Filtering\")\n",
336
- "\n",
337
- "# A dropdown filter\n",
338
- "genre_dropdown = alt.binding_select(options=genres)\n",
339
- "genre_select = alt.selection_single(fields=['Major_Genre'], bind=genre_dropdown, name='Genre')\n",
340
- "\n",
341
- "filter_genres = base.add_selection(\n",
342
- " genre_select\n",
343
- ").transform_filter(\n",
344
- " genre_select\n",
345
- ").properties(title=\"Dropdown Filtering\")\n",
346
- "\n",
347
- "#color changing marks\n",
348
- "rating_radio = alt.binding_radio(options=ratings)\n",
349
- "\n",
350
- "rating_select = alt.selection_single(fields=['MPAA_Rating'], bind=rating_radio, name='Rating')\n",
351
- "rating_color_condition = alt.condition(rating_select,\n",
352
- " alt.Color('MPAA_Rating:N', legend=None),\n",
353
- " alt.value('lightgray'))\n",
354
- "\n",
355
- "highlight_ratings = base.add_selection(\n",
356
- " rating_select\n",
357
- ").encode(\n",
358
- " color=rating_color_condition\n",
359
- ").properties(title=\"Radio Button Highlighting\")\n",
360
- "\n",
361
- "# Boolean selection for format changes\n",
362
- "input_checkbox = alt.binding_checkbox()\n",
363
- "checkbox_selection = alt.selection_single(bind=input_checkbox, name='Budget Films')\n",
364
- "\n",
365
- "size_checkbox_condition = alt.condition(checkbox_selection,\n",
366
- " alt.SizeValue(25),\n",
367
- " alt.Size('Hundred_Million_Production:Q')\n",
368
- " )\n",
369
- "\n",
370
- "budget_sizing = base.add_selection(\n",
371
- " checkbox_selection\n",
372
- ").encode(\n",
373
- " size=size_checkbox_condition\n",
374
- ").properties(title=\"Checkbox Formatting\")\n",
375
- "\n",
376
- "\n",
377
- "( filter_year | filter_genres) & (highlight_ratings | budget_sizing )\n"
378
- ]
379
- },
380
- {
381
- "cell_type": "markdown",
382
- "metadata": {},
383
- "source": [
384
- "#### Fick Dich"
150
+ "interact(main, \n",
151
+ " rabbits_birthrate=FloatSlider(min=1, max=25, step=1, value=1, \n",
152
+ " description='Birth Rate/Rabbits', style=style, layout=slider_layout),\n",
153
+ " rabbits_deathrate=FloatSlider(min=1, max=25, step=1, value=1,\n",
154
+ " description='Death Rate/Rabbits', style=style, layout=slider_layout),\n",
155
+ " foxes_birthrate=FloatSlider(min=0, max=25, step=1, value=1,\n",
156
+ " description='Birth Rate/Foxes', style=style, layout=slider_layout),\n",
157
+ " foxes_deathrate=FloatSlider(min=0, max=25, step=1, value=1,\n",
158
+ " description='Death Rate/Foxes', style=style, layout=slider_layout),\n",
159
+ " initial_rabbits=FloatSlider(min=2 , max=100, step=1, value=2,\n",
160
+ " description='Initial Rabbits', style=style, layout=slider_layout),\n",
161
+ " foxes_inicial=FloatSlider(min=1 , max=100, step=1, value=1,\n",
162
+ " description='Initial Foxes', style=style, layout=slider_layout),\n",
163
+ " days=FloatSlider(min=15, max=365 , step=10, value=15,\n",
164
+ " description='Number of Days', style=style, layout=slider_layout),\n",
165
+ " );"
385
166
  ]
386
167
  }
387
168
  ],