j1-template 2022.5.0.rc3 → 2022.5.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/data/banner.html +2 -2
- data/assets/themes/j1/adapter/js/masterslider.js +22 -5
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/_config.yml +3 -3
- data/lib/starter_web/_data/blocks/banner.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/masterslider.yml +1 -1
- data/lib/starter_web/_data/modules/masterslider.yml +0 -4
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_interactive_widgets.html +512 -512
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_nbi_widgets.html +629 -629
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_nbi_widgets_bar_chart.html +95 -95
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_nbi_widgets_hist_chart.html +93 -93
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_nbi_widgets_line_chart.html +96 -96
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_nbi_widgets_question_multiple_choice.html +70 -70
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_nbi_widgets_question_short_answer.html +156 -156
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_nbi_widgets_scatter_chart.html +95 -95
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_nbi_widgets_scatter_drag_chart.html +93 -93
- data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_odes_in_python.html +955 -955
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +2 -2
@@ -1,95 +1,95 @@
|
|
1
|
-
<div class="cell text_cell">
|
2
|
-
<button class="js-nbinteract-widget">
|
3
|
-
Loading widgets...
|
4
|
-
</button>
|
5
|
-
</div>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<div class="
|
13
|
-
cell border-box-sizing code_cell rendered">
|
14
|
-
<div class="input">
|
15
|
-
|
16
|
-
<div class="inner_cell">
|
17
|
-
<div class="input_area">
|
18
|
-
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">import</span> <span class="nn">nbinteract</span> <span class="k">as</span> <span class="nn">nbi</span>
|
19
|
-
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
20
|
-
</pre></div>
|
21
|
-
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
|
26
|
-
</div>
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<div class="
|
31
|
-
cell border-box-sizing code_cell rendered">
|
32
|
-
<div class="input">
|
33
|
-
|
34
|
-
<div class="inner_cell">
|
35
|
-
<div class="input_area">
|
36
|
-
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">x_fn</span><span class="p">(</span><span class="n">n</span><span class="p">):</span>
|
37
|
-
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">n</span><span class="p">)</span>
|
38
|
-
|
39
|
-
<span class="k">def</span> <span class="nf">y_fn</span><span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">offset</span><span class="p">):</span>
|
40
|
-
<span class="k">return</span> <span class="n">xs</span> <span class="o">+</span> <span class="n">offset</span>
|
41
|
-
|
42
|
-
|
43
|
-
<span class="n">options</span> <span class="o">=</span> <span class="p">{</span>
|
44
|
-
<span class="s1">'title'</span><span class="p">:</span> <span class="s1">'Bar chart'</span><span class="p">,</span>
|
45
|
-
<span class="s1">'xlabel'</span><span class="p">:</span> <span class="s1">'Number of bars (n)'</span><span class="p">,</span>
|
46
|
-
<span class="s1">'ylabel'</span><span class="p">:</span> <span class="s1">'Offset value'</span><span class="p">,</span>
|
47
|
-
<span class="s1">'animation_duration'</span><span class="p">:</span> <span class="mi">500</span><span class="p">,</span>
|
48
|
-
<span class="s1">'aspect_ratio'</span><span class="p">:</span> <span class="mf">1.778</span><span class="p">,</span>
|
49
|
-
<span class="s1">'ylim'</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
|
50
|
-
<span class="p">}</span>
|
51
|
-
|
52
|
-
<span class="n">layouts</span> <span class="o">=</span> <span class="p">{</span>
|
53
|
-
<span class="s1">'plot_height'</span><span class="p">:</span> <span class="s1">'480px'</span><span class="p">,</span>
|
54
|
-
<span class="s1">'plot_width'</span><span class="p">:</span> <span class="s1">'800px'</span><span class="p">,</span>
|
55
|
-
<span class="p">}</span>
|
56
|
-
|
57
|
-
<span class="n">bar_chart</span> <span class="o">=</span> <span class="n">nbi</span><span class="o">.</span><span class="n">bar</span><span class="p">(</span>
|
58
|
-
<span class="n">x_fn</span><span class="p">,</span>
|
59
|
-
<span class="n">y_fn</span><span class="p">,</span>
|
60
|
-
<span class="n">n</span><span class="o">=</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
|
61
|
-
<span class="n">offset</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
|
62
|
-
<span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">,</span>
|
63
|
-
<span class="n">layouts</span><span class="o">=</span><span class="n">layouts</span>
|
64
|
-
<span class="p">)</span>
|
65
|
-
|
66
|
-
<span class="n">bar_chart</span>
|
67
|
-
</pre></div>
|
68
|
-
|
69
|
-
</div>
|
70
|
-
</div>
|
71
|
-
</div>
|
72
|
-
|
73
|
-
<div class="output_wrapper">
|
74
|
-
<div class="output">
|
75
|
-
|
76
|
-
|
77
|
-
<div class="output_area">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
<div class="output_subarea output_widget_view ">
|
84
|
-
<button class="js-nbinteract-widget">
|
85
|
-
Loading widgets...
|
86
|
-
</button>
|
87
|
-
</div>
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
</div>
|
92
|
-
</div>
|
93
|
-
|
94
|
-
</div>
|
95
|
-
|
1
|
+
<div class="cell text_cell">
|
2
|
+
<button class="js-nbinteract-widget">
|
3
|
+
Loading widgets...
|
4
|
+
</button>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
<div class="
|
13
|
+
cell border-box-sizing code_cell rendered">
|
14
|
+
<div class="input">
|
15
|
+
|
16
|
+
<div class="inner_cell">
|
17
|
+
<div class="input_area">
|
18
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">import</span> <span class="nn">nbinteract</span> <span class="k">as</span> <span class="nn">nbi</span>
|
19
|
+
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
20
|
+
</pre></div>
|
21
|
+
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
</div>
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
<div class="
|
31
|
+
cell border-box-sizing code_cell rendered">
|
32
|
+
<div class="input">
|
33
|
+
|
34
|
+
<div class="inner_cell">
|
35
|
+
<div class="input_area">
|
36
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">x_fn</span><span class="p">(</span><span class="n">n</span><span class="p">):</span>
|
37
|
+
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">n</span><span class="p">)</span>
|
38
|
+
|
39
|
+
<span class="k">def</span> <span class="nf">y_fn</span><span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">offset</span><span class="p">):</span>
|
40
|
+
<span class="k">return</span> <span class="n">xs</span> <span class="o">+</span> <span class="n">offset</span>
|
41
|
+
|
42
|
+
|
43
|
+
<span class="n">options</span> <span class="o">=</span> <span class="p">{</span>
|
44
|
+
<span class="s1">'title'</span><span class="p">:</span> <span class="s1">'Bar chart'</span><span class="p">,</span>
|
45
|
+
<span class="s1">'xlabel'</span><span class="p">:</span> <span class="s1">'Number of bars (n)'</span><span class="p">,</span>
|
46
|
+
<span class="s1">'ylabel'</span><span class="p">:</span> <span class="s1">'Offset value'</span><span class="p">,</span>
|
47
|
+
<span class="s1">'animation_duration'</span><span class="p">:</span> <span class="mi">500</span><span class="p">,</span>
|
48
|
+
<span class="s1">'aspect_ratio'</span><span class="p">:</span> <span class="mf">1.778</span><span class="p">,</span>
|
49
|
+
<span class="s1">'ylim'</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
|
50
|
+
<span class="p">}</span>
|
51
|
+
|
52
|
+
<span class="n">layouts</span> <span class="o">=</span> <span class="p">{</span>
|
53
|
+
<span class="s1">'plot_height'</span><span class="p">:</span> <span class="s1">'480px'</span><span class="p">,</span>
|
54
|
+
<span class="s1">'plot_width'</span><span class="p">:</span> <span class="s1">'800px'</span><span class="p">,</span>
|
55
|
+
<span class="p">}</span>
|
56
|
+
|
57
|
+
<span class="n">bar_chart</span> <span class="o">=</span> <span class="n">nbi</span><span class="o">.</span><span class="n">bar</span><span class="p">(</span>
|
58
|
+
<span class="n">x_fn</span><span class="p">,</span>
|
59
|
+
<span class="n">y_fn</span><span class="p">,</span>
|
60
|
+
<span class="n">n</span><span class="o">=</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
|
61
|
+
<span class="n">offset</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
|
62
|
+
<span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">,</span>
|
63
|
+
<span class="n">layouts</span><span class="o">=</span><span class="n">layouts</span>
|
64
|
+
<span class="p">)</span>
|
65
|
+
|
66
|
+
<span class="n">bar_chart</span>
|
67
|
+
</pre></div>
|
68
|
+
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<div class="output_wrapper">
|
74
|
+
<div class="output">
|
75
|
+
|
76
|
+
|
77
|
+
<div class="output_area">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
<div class="output_subarea output_widget_view ">
|
84
|
+
<button class="js-nbinteract-widget">
|
85
|
+
Loading widgets...
|
86
|
+
</button>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_nbi_widgets_hist_chart.html
CHANGED
@@ -1,93 +1,93 @@
|
|
1
|
-
<div class="cell text_cell">
|
2
|
-
<button class="js-nbinteract-widget">
|
3
|
-
Loading widgets...
|
4
|
-
</button>
|
5
|
-
</div>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<div class="
|
13
|
-
cell border-box-sizing code_cell rendered">
|
14
|
-
<div class="input">
|
15
|
-
|
16
|
-
<div class="inner_cell">
|
17
|
-
<div class="input_area">
|
18
|
-
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">import</span> <span class="nn">nbinteract</span> <span class="k">as</span> <span class="nn">nbi</span>
|
19
|
-
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
20
|
-
</pre></div>
|
21
|
-
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
|
26
|
-
</div>
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<div class="
|
31
|
-
cell border-box-sizing code_cell rendered">
|
32
|
-
<div class="input">
|
33
|
-
|
34
|
-
<div class="inner_cell">
|
35
|
-
<div class="input_area">
|
36
|
-
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">hist_function</span><span class="p">(</span><span class="n">mean</span><span class="p">,</span> <span class="n">sd</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">1000</span><span class="p">):</span>
|
37
|
-
<span class="sd">'''</span>
|
38
|
-
<span class="sd"> Returns 1000 values picked at random from the normal</span>
|
39
|
-
<span class="sd"> distribution with the Mean value and SD given.</span>
|
40
|
-
<span class="sd"> '''</span>
|
41
|
-
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="n">mean</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="n">sd</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">1000</span><span class="p">)</span>
|
42
|
-
|
43
|
-
|
44
|
-
<span class="n">options</span> <span class="o">=</span> <span class="p">{</span>
|
45
|
-
<span class="s1">'title'</span><span class="p">:</span> <span class="s1">'Histogram'</span><span class="p">,</span>
|
46
|
-
<span class="s1">'xlabel'</span><span class="p">:</span> <span class="s1">'Mean value (mean)'</span><span class="p">,</span>
|
47
|
-
<span class="s1">'ylabel'</span><span class="p">:</span> <span class="s1">'Standard Deviation (sd)'</span><span class="p">,</span>
|
48
|
-
<span class="s1">'bins'</span><span class="p">:</span> <span class="mi">10</span>
|
49
|
-
<span class="p">}</span>
|
50
|
-
|
51
|
-
<span class="n">layouts</span> <span class="o">=</span> <span class="p">{</span>
|
52
|
-
<span class="s1">'plot_height'</span><span class="p">:</span> <span class="s1">'480px'</span><span class="p">,</span>
|
53
|
-
<span class="s1">'plot_width'</span><span class="p">:</span> <span class="s1">'800px'</span><span class="p">,</span>
|
54
|
-
<span class="p">}</span>
|
55
|
-
|
56
|
-
<span class="n">hist_chart</span> <span class="o">=</span> <span class="n">nbi</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span>
|
57
|
-
<span class="n">hist_function</span><span class="p">,</span>
|
58
|
-
<span class="n">mean</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
|
59
|
-
<span class="n">sd</span><span class="o">=</span><span class="p">(</span><span class="mf">0.2</span><span class="p">,</span> <span class="mf">2.0</span><span class="p">,</span> <span class="mf">0.2</span><span class="p">),</span>
|
60
|
-
<span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">,</span>
|
61
|
-
<span class="n">layouts</span><span class="o">=</span><span class="n">layouts</span>
|
62
|
-
<span class="p">)</span>
|
63
|
-
|
64
|
-
<span class="n">hist_chart</span>
|
65
|
-
</pre></div>
|
66
|
-
|
67
|
-
</div>
|
68
|
-
</div>
|
69
|
-
</div>
|
70
|
-
|
71
|
-
<div class="output_wrapper">
|
72
|
-
<div class="output">
|
73
|
-
|
74
|
-
|
75
|
-
<div class="output_area">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div class="output_subarea output_widget_view ">
|
82
|
-
<button class="js-nbinteract-widget">
|
83
|
-
Loading widgets...
|
84
|
-
</button>
|
85
|
-
</div>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
</div>
|
90
|
-
</div>
|
91
|
-
|
92
|
-
</div>
|
93
|
-
|
1
|
+
<div class="cell text_cell">
|
2
|
+
<button class="js-nbinteract-widget">
|
3
|
+
Loading widgets...
|
4
|
+
</button>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
<div class="
|
13
|
+
cell border-box-sizing code_cell rendered">
|
14
|
+
<div class="input">
|
15
|
+
|
16
|
+
<div class="inner_cell">
|
17
|
+
<div class="input_area">
|
18
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">import</span> <span class="nn">nbinteract</span> <span class="k">as</span> <span class="nn">nbi</span>
|
19
|
+
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
20
|
+
</pre></div>
|
21
|
+
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
</div>
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
<div class="
|
31
|
+
cell border-box-sizing code_cell rendered">
|
32
|
+
<div class="input">
|
33
|
+
|
34
|
+
<div class="inner_cell">
|
35
|
+
<div class="input_area">
|
36
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">hist_function</span><span class="p">(</span><span class="n">mean</span><span class="p">,</span> <span class="n">sd</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">1000</span><span class="p">):</span>
|
37
|
+
<span class="sd">'''</span>
|
38
|
+
<span class="sd"> Returns 1000 values picked at random from the normal</span>
|
39
|
+
<span class="sd"> distribution with the Mean value and SD given.</span>
|
40
|
+
<span class="sd"> '''</span>
|
41
|
+
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="n">mean</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="n">sd</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">1000</span><span class="p">)</span>
|
42
|
+
|
43
|
+
|
44
|
+
<span class="n">options</span> <span class="o">=</span> <span class="p">{</span>
|
45
|
+
<span class="s1">'title'</span><span class="p">:</span> <span class="s1">'Histogram'</span><span class="p">,</span>
|
46
|
+
<span class="s1">'xlabel'</span><span class="p">:</span> <span class="s1">'Mean value (mean)'</span><span class="p">,</span>
|
47
|
+
<span class="s1">'ylabel'</span><span class="p">:</span> <span class="s1">'Standard Deviation (sd)'</span><span class="p">,</span>
|
48
|
+
<span class="s1">'bins'</span><span class="p">:</span> <span class="mi">10</span>
|
49
|
+
<span class="p">}</span>
|
50
|
+
|
51
|
+
<span class="n">layouts</span> <span class="o">=</span> <span class="p">{</span>
|
52
|
+
<span class="s1">'plot_height'</span><span class="p">:</span> <span class="s1">'480px'</span><span class="p">,</span>
|
53
|
+
<span class="s1">'plot_width'</span><span class="p">:</span> <span class="s1">'800px'</span><span class="p">,</span>
|
54
|
+
<span class="p">}</span>
|
55
|
+
|
56
|
+
<span class="n">hist_chart</span> <span class="o">=</span> <span class="n">nbi</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span>
|
57
|
+
<span class="n">hist_function</span><span class="p">,</span>
|
58
|
+
<span class="n">mean</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
|
59
|
+
<span class="n">sd</span><span class="o">=</span><span class="p">(</span><span class="mf">0.2</span><span class="p">,</span> <span class="mf">2.0</span><span class="p">,</span> <span class="mf">0.2</span><span class="p">),</span>
|
60
|
+
<span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">,</span>
|
61
|
+
<span class="n">layouts</span><span class="o">=</span><span class="n">layouts</span>
|
62
|
+
<span class="p">)</span>
|
63
|
+
|
64
|
+
<span class="n">hist_chart</span>
|
65
|
+
</pre></div>
|
66
|
+
|
67
|
+
</div>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
|
71
|
+
<div class="output_wrapper">
|
72
|
+
<div class="output">
|
73
|
+
|
74
|
+
|
75
|
+
<div class="output_area">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div class="output_subarea output_widget_view ">
|
82
|
+
<button class="js-nbinteract-widget">
|
83
|
+
Loading widgets...
|
84
|
+
</button>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_nbi_widgets_line_chart.html
CHANGED
@@ -1,96 +1,96 @@
|
|
1
|
-
<div class="cell text_cell">
|
2
|
-
<button class="js-nbinteract-widget">
|
3
|
-
Loading widgets...
|
4
|
-
</button>
|
5
|
-
</div>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<div class="
|
13
|
-
cell border-box-sizing code_cell rendered">
|
14
|
-
<div class="input">
|
15
|
-
|
16
|
-
<div class="inner_cell">
|
17
|
-
<div class="input_area">
|
18
|
-
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">import</span> <span class="nn">nbinteract</span> <span class="k">as</span> <span class="nn">nbi</span>
|
19
|
-
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
20
|
-
<span class="kn">from</span> <span class="nn">numpy</span> <span class="kn">import</span> <span class="n">arange</span>
|
21
|
-
</pre></div>
|
22
|
-
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
|
27
|
-
</div>
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
<div class="
|
32
|
-
cell border-box-sizing code_cell rendered">
|
33
|
-
<div class="input">
|
34
|
-
|
35
|
-
<div class="inner_cell">
|
36
|
-
<div class="input_area">
|
37
|
-
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">x_fn</span><span class="p">(</span><span class="nb">max</span><span class="p">):</span>
|
38
|
-
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">max</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
|
39
|
-
|
40
|
-
<span class="k">def</span> <span class="nf">y_fn</span><span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">noise</span><span class="p">):</span>
|
41
|
-
<span class="k">return</span> <span class="n">xs</span> <span class="o">+</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="n">noise</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="n">xs</span><span class="p">))</span>
|
42
|
-
|
43
|
-
|
44
|
-
<span class="n">options</span> <span class="o">=</span> <span class="p">{</span>
|
45
|
-
<span class="s1">'title'</span><span class="p">:</span> <span class="s1">'Line chart'</span><span class="p">,</span>
|
46
|
-
<span class="s1">'xlabel'</span><span class="p">:</span> <span class="s1">'x-values (max)'</span><span class="p">,</span>
|
47
|
-
<span class="s1">'ylabel'</span><span class="p">:</span> <span class="s1">'y-values (noise)'</span><span class="p">,</span>
|
48
|
-
<span class="s1">'xlim'</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">50</span><span class="p">),</span>
|
49
|
-
<span class="s1">'ylim'</span><span class="p">:</span> <span class="p">(</span><span class="o">-</span><span class="mi">20</span><span class="p">,</span> <span class="mi">70</span><span class="p">),</span>
|
50
|
-
<span class="s1">'animation_duration'</span><span class="p">:</span> <span class="mi">500</span>
|
51
|
-
<span class="p">}</span>
|
52
|
-
|
53
|
-
<span class="n">layouts</span> <span class="o">=</span> <span class="p">{</span>
|
54
|
-
<span class="s1">'plot_height'</span><span class="p">:</span> <span class="s1">'480px'</span><span class="p">,</span>
|
55
|
-
<span class="s1">'plot_width'</span><span class="p">:</span> <span class="s1">'800px'</span><span class="p">,</span>
|
56
|
-
<span class="p">}</span>
|
57
|
-
|
58
|
-
<span class="n">line_chart</span> <span class="o">=</span> <span class="n">nbi</span><span class="o">.</span><span class="n">line</span><span class="p">(</span>
|
59
|
-
<span class="n">x_fn</span><span class="p">,</span>
|
60
|
-
<span class="n">y_fn</span><span class="p">,</span>
|
61
|
-
<span class="nb">max</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">50</span><span class="p">),</span>
|
62
|
-
<span class="n">noise</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
|
63
|
-
<span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">,</span>
|
64
|
-
<span class="n">layouts</span><span class="o">=</span><span class="n">layouts</span>
|
65
|
-
<span class="p">)</span>
|
66
|
-
|
67
|
-
<span class="n">line_chart</span>
|
68
|
-
</pre></div>
|
69
|
-
|
70
|
-
</div>
|
71
|
-
</div>
|
72
|
-
</div>
|
73
|
-
|
74
|
-
<div class="output_wrapper">
|
75
|
-
<div class="output">
|
76
|
-
|
77
|
-
|
78
|
-
<div class="output_area">
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
<div class="output_subarea output_widget_view ">
|
85
|
-
<button class="js-nbinteract-widget">
|
86
|
-
Loading widgets...
|
87
|
-
</button>
|
88
|
-
</div>
|
89
|
-
|
90
|
-
</div>
|
91
|
-
|
92
|
-
</div>
|
93
|
-
</div>
|
94
|
-
|
95
|
-
</div>
|
96
|
-
|
1
|
+
<div class="cell text_cell">
|
2
|
+
<button class="js-nbinteract-widget">
|
3
|
+
Loading widgets...
|
4
|
+
</button>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
<div class="
|
13
|
+
cell border-box-sizing code_cell rendered">
|
14
|
+
<div class="input">
|
15
|
+
|
16
|
+
<div class="inner_cell">
|
17
|
+
<div class="input_area">
|
18
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">import</span> <span class="nn">nbinteract</span> <span class="k">as</span> <span class="nn">nbi</span>
|
19
|
+
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
20
|
+
<span class="kn">from</span> <span class="nn">numpy</span> <span class="kn">import</span> <span class="n">arange</span>
|
21
|
+
</pre></div>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
<div class="
|
32
|
+
cell border-box-sizing code_cell rendered">
|
33
|
+
<div class="input">
|
34
|
+
|
35
|
+
<div class="inner_cell">
|
36
|
+
<div class="input_area">
|
37
|
+
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">x_fn</span><span class="p">(</span><span class="nb">max</span><span class="p">):</span>
|
38
|
+
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">max</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
|
39
|
+
|
40
|
+
<span class="k">def</span> <span class="nf">y_fn</span><span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">noise</span><span class="p">):</span>
|
41
|
+
<span class="k">return</span> <span class="n">xs</span> <span class="o">+</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="n">noise</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="n">xs</span><span class="p">))</span>
|
42
|
+
|
43
|
+
|
44
|
+
<span class="n">options</span> <span class="o">=</span> <span class="p">{</span>
|
45
|
+
<span class="s1">'title'</span><span class="p">:</span> <span class="s1">'Line chart'</span><span class="p">,</span>
|
46
|
+
<span class="s1">'xlabel'</span><span class="p">:</span> <span class="s1">'x-values (max)'</span><span class="p">,</span>
|
47
|
+
<span class="s1">'ylabel'</span><span class="p">:</span> <span class="s1">'y-values (noise)'</span><span class="p">,</span>
|
48
|
+
<span class="s1">'xlim'</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">50</span><span class="p">),</span>
|
49
|
+
<span class="s1">'ylim'</span><span class="p">:</span> <span class="p">(</span><span class="o">-</span><span class="mi">20</span><span class="p">,</span> <span class="mi">70</span><span class="p">),</span>
|
50
|
+
<span class="s1">'animation_duration'</span><span class="p">:</span> <span class="mi">500</span>
|
51
|
+
<span class="p">}</span>
|
52
|
+
|
53
|
+
<span class="n">layouts</span> <span class="o">=</span> <span class="p">{</span>
|
54
|
+
<span class="s1">'plot_height'</span><span class="p">:</span> <span class="s1">'480px'</span><span class="p">,</span>
|
55
|
+
<span class="s1">'plot_width'</span><span class="p">:</span> <span class="s1">'800px'</span><span class="p">,</span>
|
56
|
+
<span class="p">}</span>
|
57
|
+
|
58
|
+
<span class="n">line_chart</span> <span class="o">=</span> <span class="n">nbi</span><span class="o">.</span><span class="n">line</span><span class="p">(</span>
|
59
|
+
<span class="n">x_fn</span><span class="p">,</span>
|
60
|
+
<span class="n">y_fn</span><span class="p">,</span>
|
61
|
+
<span class="nb">max</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">50</span><span class="p">),</span>
|
62
|
+
<span class="n">noise</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
|
63
|
+
<span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">,</span>
|
64
|
+
<span class="n">layouts</span><span class="o">=</span><span class="n">layouts</span>
|
65
|
+
<span class="p">)</span>
|
66
|
+
|
67
|
+
<span class="n">line_chart</span>
|
68
|
+
</pre></div>
|
69
|
+
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
</div>
|
73
|
+
|
74
|
+
<div class="output_wrapper">
|
75
|
+
<div class="output">
|
76
|
+
|
77
|
+
|
78
|
+
<div class="output_area">
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
<div class="output_subarea output_widget_view ">
|
85
|
+
<button class="js-nbinteract-widget">
|
86
|
+
Loading widgets...
|
87
|
+
</button>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|