rubydown 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +35 -0
  3. data/.gitignore +3 -0
  4. data/Dockerfile +9 -0
  5. data/Gemfile +8 -0
  6. data/Gemfile.lock +43 -0
  7. data/LICENSE +21 -0
  8. data/README.md +32 -0
  9. data/Rakefile +2 -0
  10. data/_config.yml +1 -0
  11. data/appveyor.yml +25 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/docs/_config.yml +1 -0
  15. data/docs/index.html +20 -0
  16. data/docs/sidebyside.md +1 -0
  17. data/examples/bio.html +129 -0
  18. data/examples/bio.md +73 -0
  19. data/examples/graph.html +160 -0
  20. data/examples/graph.md +11 -0
  21. data/examples/index.html +217 -0
  22. data/examples/index.md +58 -0
  23. data/examples/numo-gnuplot.ipynb +1515 -0
  24. data/examples/rbplotly-bar.html +146 -0
  25. data/examples/rbplotly-bar.md +54 -0
  26. data/examples/rbplotly-basic.html +134 -0
  27. data/examples/rbplotly-basic.md +43 -0
  28. data/examples/rbplotly-boxplot.html +136 -0
  29. data/examples/rbplotly-boxplot.md +60 -0
  30. data/examples/rbplotly-heatmap.html +95 -0
  31. data/examples/rbplotly-heatmap.md +35 -0
  32. data/examples/rbplotly-hist.html +52 -0
  33. data/examples/rbplotly-hist.md +9 -0
  34. data/examples/rbplotly-line.html +62 -0
  35. data/examples/rbplotly-line.md +19 -0
  36. data/examples/rbplotly-pie.html +100 -0
  37. data/examples/rbplotly-pie.md +40 -0
  38. data/examples/rbplotly-scatter.html +148 -0
  39. data/examples/rbplotly-scatter.md +71 -0
  40. data/examples/rumale-kmeans.html +75 -0
  41. data/examples/rumale-kmeans.md +33 -0
  42. data/examples/rumale.html +967 -0
  43. data/examples/rumale.md +31 -0
  44. data/examples/table.html +57 -0
  45. data/examples/table.md +7 -0
  46. data/exe/rubydown +114 -0
  47. data/lib/rubydown.rb +59 -0
  48. data/lib/rubydown/version.rb +3 -0
  49. data/rubydown.gemspec +47 -0
  50. data/templates/template.html.erb +26 -0
  51. metadata +207 -0
@@ -0,0 +1,146 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <link href='https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.min.css' rel='stylesheet' type='text/css' />
6
+ <style>
7
+ article.markdown-body {
8
+ box-sizing: border-box;
9
+ min-width: 200px;
10
+ max-width: 980px;
11
+ margin: 0 auto;
12
+ padding: 45px;
13
+ }
14
+
15
+ span.line-numbers {
16
+ display: none;
17
+ }
18
+ </style>
19
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
20
+ </head>
21
+ <body>
22
+ <article class='markdown-body'>
23
+ <h1 id="rbplotly-bar-chart-usage">rbplotly bar chart usage</h1>
24
+
25
+ <pre><code class="language-ruby">require 'rbplotly'
26
+
27
+ trace = {
28
+ x: %w(giraffes orangutans monkeys),
29
+ y: [20, 14, 23],
30
+ type: :bar
31
+ }
32
+
33
+ plot = Plotly::Plot.new(data: [trace])
34
+ </code></pre>
35
+ <script>
36
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
37
+ </script>
38
+ <div id="f57ddb9a-9afb-4c41-8137-6550a9948dd0" style="height: 100%; width: 100%;"></div>
39
+ <script>
40
+ require(['plotly'], function(Plotly) {
41
+ Plotly.newPlot(
42
+ 'f57ddb9a-9afb-4c41-8137-6550a9948dd0',
43
+ [{"x":["giraffes","orangutans","monkeys"],"y":[20,14,23],"type":"bar"}],
44
+ {},
45
+ {"linkText":"Export to plot.ly","showLink":true}
46
+ )
47
+
48
+ window.addEventListener('resize', function() {
49
+ Plotly.Plots.resize(document.getElementById('f57ddb9a-9afb-4c41-8137-6550a9948dd0'))
50
+ })
51
+ })
52
+ </script>
53
+
54
+ <pre><code class="language-ruby">trace1 = {
55
+ x: %w(giraffes orangutans monkeys),
56
+ y: [20, 14, 23],
57
+ type: :bar,
58
+ name: 'SF Zoo'
59
+ }
60
+ trace2 = {
61
+ x: %w(giraffes orangutans monkeys),
62
+ y: [12, 18, 29],
63
+ type: :bar,
64
+ name: 'LA Zoo'
65
+ }
66
+
67
+ plot = Plotly::Plot.new(data: [trace1, trace2])
68
+ </code></pre>
69
+ <script>
70
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
71
+ </script>
72
+ <div id="9cc69556-b77a-4815-b282-c930c47af9a8" style="height: 100%; width: 100%;"></div>
73
+ <script>
74
+ require(['plotly'], function(Plotly) {
75
+ Plotly.newPlot(
76
+ '9cc69556-b77a-4815-b282-c930c47af9a8',
77
+ [{"x":["giraffes","orangutans","monkeys"],"y":[20,14,23],"type":"bar","name":"SF Zoo"},{"x":["giraffes","orangutans","monkeys"],"y":[12,18,29],"type":"bar","name":"LA Zoo"}],
78
+ {},
79
+ {"linkText":"Export to plot.ly","showLink":true}
80
+ )
81
+
82
+ window.addEventListener('resize', function() {
83
+ Plotly.Plots.resize(document.getElementById('9cc69556-b77a-4815-b282-c930c47af9a8'))
84
+ })
85
+ })
86
+ </script>
87
+
88
+ <pre><code class="language-ruby">plot.layout.barmode = :stack
89
+ plot
90
+ </code></pre>
91
+ <script>
92
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
93
+ </script>
94
+ <div id="d9816f49-d8e4-423f-9e0b-1f6c863f9506" style="height: 100%; width: 100%;"></div>
95
+ <script>
96
+ require(['plotly'], function(Plotly) {
97
+ Plotly.newPlot(
98
+ 'd9816f49-d8e4-423f-9e0b-1f6c863f9506',
99
+ [{"x":["giraffes","orangutans","monkeys"],"y":[20,14,23],"type":"bar","name":"SF Zoo"},{"x":["giraffes","orangutans","monkeys"],"y":[12,18,29],"type":"bar","name":"LA Zoo"}],
100
+ {"barmode":"stack"},
101
+ {"linkText":"Export to plot.ly","showLink":true}
102
+ )
103
+
104
+ window.addEventListener('resize', function() {
105
+ Plotly.Plots.resize(document.getElementById('d9816f49-d8e4-423f-9e0b-1f6c863f9506'))
106
+ })
107
+ })
108
+ </script>
109
+
110
+ <pre><code class="language-ruby">trace1 = {
111
+ x: %w(giraffes orangutans monkeys),
112
+ y: [20, 14, 23],
113
+ type: :bar,
114
+ name: 'SF Zoo'
115
+ }
116
+ trace2 = {
117
+ x: %w(giraffes orangutans monkeys),
118
+ y: [12, 18, 29],
119
+ type: :bar,
120
+ name: 'LA Zoo'
121
+ }
122
+
123
+ plot = Plotly::Plot.new(data: [trace1, trace2], layout: { barmode: :stack } )
124
+ </code></pre>
125
+ <script>
126
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
127
+ </script>
128
+ <div id="fea2c088-56da-46d0-b468-ae4d6885862f" style="height: 100%; width: 100%;"></div>
129
+ <script>
130
+ require(['plotly'], function(Plotly) {
131
+ Plotly.newPlot(
132
+ 'fea2c088-56da-46d0-b468-ae4d6885862f',
133
+ [{"x":["giraffes","orangutans","monkeys"],"y":[20,14,23],"type":"bar","name":"SF Zoo"},{"x":["giraffes","orangutans","monkeys"],"y":[12,18,29],"type":"bar","name":"LA Zoo"}],
134
+ {"barmode":"stack"},
135
+ {"linkText":"Export to plot.ly","showLink":true}
136
+ )
137
+
138
+ window.addEventListener('resize', function() {
139
+ Plotly.Plots.resize(document.getElementById('fea2c088-56da-46d0-b468-ae4d6885862f'))
140
+ })
141
+ })
142
+ </script>
143
+
144
+ </article>
145
+ </body>
146
+ </html>
@@ -0,0 +1,54 @@
1
+ # rbplotly bar chart usage
2
+
3
+
4
+ ~~~ruby
5
+ require 'rbplotly'
6
+
7
+ trace = {
8
+ x: %w(giraffes orangutans monkeys),
9
+ y: [20, 14, 23],
10
+ type: :bar
11
+ }
12
+
13
+ plot = Plotly::Plot.new(data: [trace])
14
+ ~~~
15
+
16
+
17
+ ~~~ruby
18
+ trace1 = {
19
+ x: %w(giraffes orangutans monkeys),
20
+ y: [20, 14, 23],
21
+ type: :bar,
22
+ name: 'SF Zoo'
23
+ }
24
+ trace2 = {
25
+ x: %w(giraffes orangutans monkeys),
26
+ y: [12, 18, 29],
27
+ type: :bar,
28
+ name: 'LA Zoo'
29
+ }
30
+
31
+ plot = Plotly::Plot.new(data: [trace1, trace2])
32
+ ~~~
33
+
34
+ ~~~ruby
35
+ plot.layout.barmode = :stack
36
+ plot
37
+ ~~~
38
+
39
+ ~~~ruby
40
+ trace1 = {
41
+ x: %w(giraffes orangutans monkeys),
42
+ y: [20, 14, 23],
43
+ type: :bar,
44
+ name: 'SF Zoo'
45
+ }
46
+ trace2 = {
47
+ x: %w(giraffes orangutans monkeys),
48
+ y: [12, 18, 29],
49
+ type: :bar,
50
+ name: 'LA Zoo'
51
+ }
52
+
53
+ plot = Plotly::Plot.new(data: [trace1, trace2], layout: { barmode: :stack } )
54
+ ~~~
@@ -0,0 +1,134 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <link href='https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.min.css' rel='stylesheet' type='text/css' />
6
+ <style>
7
+ article.markdown-body {
8
+ box-sizing: border-box;
9
+ min-width: 200px;
10
+ max-width: 980px;
11
+ margin: 0 auto;
12
+ padding: 45px;
13
+ }
14
+
15
+ span.line-numbers {
16
+ display: none;
17
+ }
18
+ </style>
19
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
20
+ </head>
21
+ <body>
22
+ <article class='markdown-body'>
23
+ <h1 id="rbplotly-basic-usage">rbplotly basic usage</h1>
24
+
25
+ <pre><code class="language-ruby">require 'rbplotly'
26
+
27
+ n = 100
28
+
29
+ x = n.times.map { |i| i.to_f / (n - 1) }
30
+ y0 = n.times.map { rand(-2.0..2.0) + 5 }
31
+ y1 = n.times.map { rand(-2.0..2.0) }
32
+
33
+ trace0 = { x: x, y: y0, type: :scatter, mode: :markers }
34
+ trace1 = trace0.merge(y: y1, mode: :'markers+lines')
35
+
36
+ plot = Plotly::Plot.new(data: [trace0, trace1])
37
+ </code></pre>
38
+ <script>
39
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
40
+ </script>
41
+ <div id="53f95bc4-090f-4389-a4c0-8c469ea4b6c3" style="height: 100%; width: 100%;"></div>
42
+ <script>
43
+ require(['plotly'], function(Plotly) {
44
+ Plotly.newPlot(
45
+ '53f95bc4-090f-4389-a4c0-8c469ea4b6c3',
46
+ [{"x":[0.0,0.010101010101010102,0.020202020202020204,0.030303030303030304,0.04040404040404041,0.050505050505050504,0.06060606060606061,0.0707070707070707,0.08080808080808081,0.09090909090909091,0.10101010101010101,0.1111111111111111,0.12121212121212122,0.13131313131313133,0.1414141414141414,0.15151515151515152,0.16161616161616163,0.1717171717171717,0.18181818181818182,0.1919191919191919,0.20202020202020202,0.21212121212121213,0.2222222222222222,0.23232323232323232,0.24242424242424243,0.25252525252525254,0.26262626262626265,0.2727272727272727,0.2828282828282828,0.29292929292929293,0.30303030303030304,0.31313131313131315,0.32323232323232326,0.3333333333333333,0.3434343434343434,0.35353535353535354,0.36363636363636365,0.37373737373737376,0.3838383838383838,0.3939393939393939,0.40404040404040403,0.41414141414141414,0.42424242424242425,0.43434343434343436,0.4444444444444444,0.45454545454545453,0.46464646464646464,0.47474747474747475,0.48484848484848486,0.494949494949495,0.5050505050505051,0.5151515151515151,0.5252525252525253,0.5353535353535354,0.5454545454545454,0.5555555555555556,0.5656565656565656,0.5757575757575758,0.5858585858585859,0.5959595959595959,0.6060606060606061,0.6161616161616161,0.6262626262626263,0.6363636363636364,0.6464646464646465,0.6565656565656566,0.6666666666666666,0.6767676767676768,0.6868686868686869,0.696969696969697,0.7070707070707071,0.7171717171717171,0.7272727272727273,0.7373737373737373,0.7474747474747475,0.7575757575757576,0.7676767676767676,0.7777777777777778,0.7878787878787878,0.797979797979798,0.8080808080808081,0.8181818181818182,0.8282828282828283,0.8383838383838383,0.8484848484848485,0.8585858585858586,0.8686868686868687,0.8787878787878788,0.8888888888888888,0.898989898989899,0.9090909090909091,0.9191919191919192,0.9292929292929293,0.9393939393939394,0.9494949494949495,0.9595959595959596,0.9696969696969697,0.9797979797979798,0.98989898989899,1.0],"y":[4.985260278731374,3.0874432275191563,3.3972016489193364,5.340430214080614,4.84939140925812,5.264099671432854,4.874897973344186,3.24666316080559,6.418532003675113,4.10269970055107,3.22607963519448,6.9286465295502175,6.60220630868308,3.918162471597847,4.353998313015342,6.120422018999019,4.354177621568017,6.451127876631009,5.299286923046604,3.5950081791074875,3.5191847559850222,5.579982268941464,4.264906044420247,6.5814201362368765,3.387217479360088,6.3475099590505195,3.18293709563756,6.398864168939883,3.5321769238475613,6.5506707424504285,3.1845772116153235,4.850056212189058,3.6877545118165616,4.750411872630684,3.825048717522888,6.681674431770485,4.110994667497957,3.2519304256490984,6.9677219383836135,3.0785984444136325,4.612229081893361,5.815282332276793,6.4340149605939345,6.288654851799476,4.90444994580589,6.016825295586715,5.463653689931737,3.669405349178485,5.855663316899501,3.0966764053759994,4.168615242751988,6.6310164646795595,3.320094110870127,4.5671650467380065,4.6659136337135285,6.259580954501862,3.06390826286996,3.239835890131329,3.046214425239702,3.188817145477507,6.658771643684373,6.907298201308798,5.088721775039201,4.047867208274941,3.506443299368494,4.282226176371097,6.1985829661552625,5.886242411918925,3.2268643050765444,4.14847592463216,5.8064981572551755,4.207388156735084,4.770211560726222,5.399461251683309,3.6821934162866543,3.446494133512351,3.8157286180194525,4.845679660832243,6.296786986186008,4.05760784222344,3.75791699188679,6.3583784276916075,4.780602098940033,6.210800301711789,3.469591976580151,4.165701607580827,3.6247190750056553,3.359023818567346,5.915268591013065,6.683734646031894,5.157390490231853,6.130298749562275,6.020151526591644,3.244925017508474,6.772772136714833,3.3727209619298524,5.357675313391696,3.1935158799933725,6.859906129567399,3.9455453819319524],"type":"scatter","mode":"markers"},{"x":[0.0,0.010101010101010102,0.020202020202020204,0.030303030303030304,0.04040404040404041,0.050505050505050504,0.06060606060606061,0.0707070707070707,0.08080808080808081,0.09090909090909091,0.10101010101010101,0.1111111111111111,0.12121212121212122,0.13131313131313133,0.1414141414141414,0.15151515151515152,0.16161616161616163,0.1717171717171717,0.18181818181818182,0.1919191919191919,0.20202020202020202,0.21212121212121213,0.2222222222222222,0.23232323232323232,0.24242424242424243,0.25252525252525254,0.26262626262626265,0.2727272727272727,0.2828282828282828,0.29292929292929293,0.30303030303030304,0.31313131313131315,0.32323232323232326,0.3333333333333333,0.3434343434343434,0.35353535353535354,0.36363636363636365,0.37373737373737376,0.3838383838383838,0.3939393939393939,0.40404040404040403,0.41414141414141414,0.42424242424242425,0.43434343434343436,0.4444444444444444,0.45454545454545453,0.46464646464646464,0.47474747474747475,0.48484848484848486,0.494949494949495,0.5050505050505051,0.5151515151515151,0.5252525252525253,0.5353535353535354,0.5454545454545454,0.5555555555555556,0.5656565656565656,0.5757575757575758,0.5858585858585859,0.5959595959595959,0.6060606060606061,0.6161616161616161,0.6262626262626263,0.6363636363636364,0.6464646464646465,0.6565656565656566,0.6666666666666666,0.6767676767676768,0.6868686868686869,0.696969696969697,0.7070707070707071,0.7171717171717171,0.7272727272727273,0.7373737373737373,0.7474747474747475,0.7575757575757576,0.7676767676767676,0.7777777777777778,0.7878787878787878,0.797979797979798,0.8080808080808081,0.8181818181818182,0.8282828282828283,0.8383838383838383,0.8484848484848485,0.8585858585858586,0.8686868686868687,0.8787878787878788,0.8888888888888888,0.898989898989899,0.9090909090909091,0.9191919191919192,0.9292929292929293,0.9393939393939394,0.9494949494949495,0.9595959595959596,0.9696969696969697,0.9797979797979798,0.98989898989899,1.0],"y":[1.95207741418358,-0.37082296457795483,-1.083432645654065,1.7802543742225794,-1.3986957668490732,0.018609030418472283,1.564318884003037,0.3761881829689968,-1.324876807463494,-0.7547025172007156,1.8782667349041096,0.8012250301397197,1.2997970572067645,0.8974002210633563,1.782349719708316,-1.337465637314006,1.1950560182864547,-0.43108901454026594,0.6733700388883626,-0.5907689236915257,0.4072120395071628,-0.020296137848942575,1.3617982270087952,-0.1873617812984678,-0.042579766482127024,1.0158953234700974,1.6224972755067824,1.1218077748006836,-0.7438343346311025,-0.6686826693006349,-0.7786971227735902,-0.7251984181114906,-0.05115383667636664,1.356564151946726,1.2690274384916127,0.24459257525935296,0.37688439695425346,-0.05471613207837711,1.1095384395049113,0.0674083995921615,1.0470107738957637,-1.973877857608434,-0.15410125934598007,-1.3981419609939545,0.2610759865494421,-1.1561207588443048,-1.487588342407467,-0.3415213288233283,0.46164522412512676,-1.5937934360297739,1.0932958849077634,-1.9925641229846236,-0.9608878950840549,-0.06356137343310397,1.9768320061766547,-0.16357934253197604,1.5414795329255147,1.6454084881626962,-1.640480024211426,1.7101765210803288,-0.2109766318612909,0.3697166583066993,0.13832172432399004,1.434789138875726,0.1861158825688678,-1.2964322505121464,0.09211026572884862,-0.9803735616806142,1.9177151350599875,-1.0929699575131866,-0.4897192666818593,1.2649364669275394,-0.8555734405801192,-1.982153815720213,-1.9943871970939897,-1.314886679497659,0.4422229200537946,-0.35494711531569045,1.4716021808866664,-0.2710268083175764,-1.7497896590949513,-1.2176271363776259,-0.5361298941438353,-0.402744919908808,0.220622516665947,0.22889467416659315,1.6637509160800912,-1.611042835242542,-0.9457004183301843,-0.23078511883321529,-0.700078491257023,-0.6058540198494389,1.86039064616417,-0.04381179800810697,0.20005485847896987,-1.780153583705519,0.539557170605216,1.9006720094325043,1.223554024638534,0.8800198851000989],"type":"scatter","mode":"markers+lines"}],
47
+ {},
48
+ {"linkText":"Export to plot.ly","showLink":true}
49
+ )
50
+
51
+ window.addEventListener('resize', function() {
52
+ Plotly.Plots.resize(document.getElementById('53f95bc4-090f-4389-a4c0-8c469ea4b6c3'))
53
+ })
54
+ })
55
+ </script>
56
+
57
+ <p>Here we replace the last trace range from -0.5 to 0.5</p>
58
+
59
+ <pre><code class="language-ruby">plot.data.last.y = n.times.map { rand(-0.5..0.5) }
60
+ plot
61
+ </code></pre>
62
+ <script>
63
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
64
+ </script>
65
+ <div id="37caad6b-6b61-4b4f-89f4-f17de42cea35" style="height: 100%; width: 100%;"></div>
66
+ <script>
67
+ require(['plotly'], function(Plotly) {
68
+ Plotly.newPlot(
69
+ '37caad6b-6b61-4b4f-89f4-f17de42cea35',
70
+ [{"x":[0.0,0.010101010101010102,0.020202020202020204,0.030303030303030304,0.04040404040404041,0.050505050505050504,0.06060606060606061,0.0707070707070707,0.08080808080808081,0.09090909090909091,0.10101010101010101,0.1111111111111111,0.12121212121212122,0.13131313131313133,0.1414141414141414,0.15151515151515152,0.16161616161616163,0.1717171717171717,0.18181818181818182,0.1919191919191919,0.20202020202020202,0.21212121212121213,0.2222222222222222,0.23232323232323232,0.24242424242424243,0.25252525252525254,0.26262626262626265,0.2727272727272727,0.2828282828282828,0.29292929292929293,0.30303030303030304,0.31313131313131315,0.32323232323232326,0.3333333333333333,0.3434343434343434,0.35353535353535354,0.36363636363636365,0.37373737373737376,0.3838383838383838,0.3939393939393939,0.40404040404040403,0.41414141414141414,0.42424242424242425,0.43434343434343436,0.4444444444444444,0.45454545454545453,0.46464646464646464,0.47474747474747475,0.48484848484848486,0.494949494949495,0.5050505050505051,0.5151515151515151,0.5252525252525253,0.5353535353535354,0.5454545454545454,0.5555555555555556,0.5656565656565656,0.5757575757575758,0.5858585858585859,0.5959595959595959,0.6060606060606061,0.6161616161616161,0.6262626262626263,0.6363636363636364,0.6464646464646465,0.6565656565656566,0.6666666666666666,0.6767676767676768,0.6868686868686869,0.696969696969697,0.7070707070707071,0.7171717171717171,0.7272727272727273,0.7373737373737373,0.7474747474747475,0.7575757575757576,0.7676767676767676,0.7777777777777778,0.7878787878787878,0.797979797979798,0.8080808080808081,0.8181818181818182,0.8282828282828283,0.8383838383838383,0.8484848484848485,0.8585858585858586,0.8686868686868687,0.8787878787878788,0.8888888888888888,0.898989898989899,0.9090909090909091,0.9191919191919192,0.9292929292929293,0.9393939393939394,0.9494949494949495,0.9595959595959596,0.9696969696969697,0.9797979797979798,0.98989898989899,1.0],"y":[4.985260278731374,3.0874432275191563,3.3972016489193364,5.340430214080614,4.84939140925812,5.264099671432854,4.874897973344186,3.24666316080559,6.418532003675113,4.10269970055107,3.22607963519448,6.9286465295502175,6.60220630868308,3.918162471597847,4.353998313015342,6.120422018999019,4.354177621568017,6.451127876631009,5.299286923046604,3.5950081791074875,3.5191847559850222,5.579982268941464,4.264906044420247,6.5814201362368765,3.387217479360088,6.3475099590505195,3.18293709563756,6.398864168939883,3.5321769238475613,6.5506707424504285,3.1845772116153235,4.850056212189058,3.6877545118165616,4.750411872630684,3.825048717522888,6.681674431770485,4.110994667497957,3.2519304256490984,6.9677219383836135,3.0785984444136325,4.612229081893361,5.815282332276793,6.4340149605939345,6.288654851799476,4.90444994580589,6.016825295586715,5.463653689931737,3.669405349178485,5.855663316899501,3.0966764053759994,4.168615242751988,6.6310164646795595,3.320094110870127,4.5671650467380065,4.6659136337135285,6.259580954501862,3.06390826286996,3.239835890131329,3.046214425239702,3.188817145477507,6.658771643684373,6.907298201308798,5.088721775039201,4.047867208274941,3.506443299368494,4.282226176371097,6.1985829661552625,5.886242411918925,3.2268643050765444,4.14847592463216,5.8064981572551755,4.207388156735084,4.770211560726222,5.399461251683309,3.6821934162866543,3.446494133512351,3.8157286180194525,4.845679660832243,6.296786986186008,4.05760784222344,3.75791699188679,6.3583784276916075,4.780602098940033,6.210800301711789,3.469591976580151,4.165701607580827,3.6247190750056553,3.359023818567346,5.915268591013065,6.683734646031894,5.157390490231853,6.130298749562275,6.020151526591644,3.244925017508474,6.772772136714833,3.3727209619298524,5.357675313391696,3.1935158799933725,6.859906129567399,3.9455453819319524],"type":"scatter","mode":"markers"},{"x":[0.0,0.010101010101010102,0.020202020202020204,0.030303030303030304,0.04040404040404041,0.050505050505050504,0.06060606060606061,0.0707070707070707,0.08080808080808081,0.09090909090909091,0.10101010101010101,0.1111111111111111,0.12121212121212122,0.13131313131313133,0.1414141414141414,0.15151515151515152,0.16161616161616163,0.1717171717171717,0.18181818181818182,0.1919191919191919,0.20202020202020202,0.21212121212121213,0.2222222222222222,0.23232323232323232,0.24242424242424243,0.25252525252525254,0.26262626262626265,0.2727272727272727,0.2828282828282828,0.29292929292929293,0.30303030303030304,0.31313131313131315,0.32323232323232326,0.3333333333333333,0.3434343434343434,0.35353535353535354,0.36363636363636365,0.37373737373737376,0.3838383838383838,0.3939393939393939,0.40404040404040403,0.41414141414141414,0.42424242424242425,0.43434343434343436,0.4444444444444444,0.45454545454545453,0.46464646464646464,0.47474747474747475,0.48484848484848486,0.494949494949495,0.5050505050505051,0.5151515151515151,0.5252525252525253,0.5353535353535354,0.5454545454545454,0.5555555555555556,0.5656565656565656,0.5757575757575758,0.5858585858585859,0.5959595959595959,0.6060606060606061,0.6161616161616161,0.6262626262626263,0.6363636363636364,0.6464646464646465,0.6565656565656566,0.6666666666666666,0.6767676767676768,0.6868686868686869,0.696969696969697,0.7070707070707071,0.7171717171717171,0.7272727272727273,0.7373737373737373,0.7474747474747475,0.7575757575757576,0.7676767676767676,0.7777777777777778,0.7878787878787878,0.797979797979798,0.8080808080808081,0.8181818181818182,0.8282828282828283,0.8383838383838383,0.8484848484848485,0.8585858585858586,0.8686868686868687,0.8787878787878788,0.8888888888888888,0.898989898989899,0.9090909090909091,0.9191919191919192,0.9292929292929293,0.9393939393939394,0.9494949494949495,0.9595959595959596,0.9696969696969697,0.9797979797979798,0.98989898989899,1.0],"y":[0.1309014592531832,-0.12092090168873437,-0.24792347517937696,-0.38157421075531095,-0.3268019078778194,-0.19366233697162016,-0.443942179061388,0.037180599624911936,-0.14627691565755696,-0.009940677247018082,-0.30295374341626624,0.2152760719634741,0.16247660871789915,0.0243067480380591,0.22527302316542275,-0.33087714943701074,0.034610772960890435,-0.190052621893122,-0.4258484064183742,-0.4877942401819575,0.2985642587422195,-0.19553917306420288,-0.45996922341127533,0.1935371232359102,-0.1110200238228003,-0.36756262063299006,0.19073576501203782,-0.30942013373987065,-0.23889442087064194,-0.4179497735484513,0.41867798402743917,-0.2510924347444917,0.21331474800015482,0.2951128043964062,0.4939758438916475,-0.3425444801706504,-0.13043312817917285,0.05905557247221471,0.12799081569229065,-0.278165912650288,0.41746000291682406,0.04482934165047703,-0.4904984801013391,0.4337766385360333,0.2060303914860946,0.4915880482821098,-0.279123559700446,-0.314067421675878,0.4026829830395041,-0.36171593157990956,0.22107983735332337,-0.0024569242172961525,0.323562469238865,0.07726544536540714,0.3656573927439949,0.0933335987266064,-0.44089667224957174,-0.25751995133271965,-0.4573066253484245,-0.4234895410405297,-0.13232808952167863,0.43518980231278304,0.4636805518219457,0.22382575279867722,-0.3634747766701123,-0.2192793751684904,-0.48259545443432283,-0.3351177565952367,0.48825936616806076,0.4011710216988946,-0.12864238831313568,-0.3837269984936138,0.35605716212628435,-0.3507597046209584,0.025304456225202387,-0.28947014761445666,-0.18124159137582485,-0.2119513450098678,0.02563503800991984,-0.36412111416816695,0.3811872070883041,-0.4070236018007055,0.17014339006911772,0.0006250827619233013,-0.29327989852303793,-0.16916444426808042,0.08949126856044232,-0.15957277308698625,-0.31040096649182236,0.22869792441225412,0.13005457275494803,-0.3894224403157791,-0.06433757534720852,-0.3715771812369355,-0.17790893984091982,-0.24935490841902674,0.47839799712025044,-0.2920868208244508,0.14919724725216466,-0.3447312721260779],"type":"scatter","mode":"markers+lines"}],
71
+ {},
72
+ {"linkText":"Export to plot.ly","showLink":true}
73
+ )
74
+
75
+ window.addEventListener('resize', function() {
76
+ Plotly.Plots.resize(document.getElementById('37caad6b-6b61-4b4f-89f4-f17de42cea35'))
77
+ })
78
+ })
79
+ </script>
80
+
81
+ <p>Next we add a line trace with the center -5 and the range from -2.0 to 2.0.</p>
82
+
83
+ <pre><code class="language-ruby">new_trace = { x: x, y: n.times.map { rand(-2.0..2.0) - 5 }, type: :scatter, mode: :lines }
84
+ plot.data.push(new_trace)
85
+ plot
86
+ </code></pre>
87
+ <script>
88
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
89
+ </script>
90
+ <div id="083c5e64-9c4f-49a9-b994-1d1d19ed4dc2" style="height: 100%; width: 100%;"></div>
91
+ <script>
92
+ require(['plotly'], function(Plotly) {
93
+ Plotly.newPlot(
94
+ '083c5e64-9c4f-49a9-b994-1d1d19ed4dc2',
95
+ [{"x":[0.0,0.010101010101010102,0.020202020202020204,0.030303030303030304,0.04040404040404041,0.050505050505050504,0.06060606060606061,0.0707070707070707,0.08080808080808081,0.09090909090909091,0.10101010101010101,0.1111111111111111,0.12121212121212122,0.13131313131313133,0.1414141414141414,0.15151515151515152,0.16161616161616163,0.1717171717171717,0.18181818181818182,0.1919191919191919,0.20202020202020202,0.21212121212121213,0.2222222222222222,0.23232323232323232,0.24242424242424243,0.25252525252525254,0.26262626262626265,0.2727272727272727,0.2828282828282828,0.29292929292929293,0.30303030303030304,0.31313131313131315,0.32323232323232326,0.3333333333333333,0.3434343434343434,0.35353535353535354,0.36363636363636365,0.37373737373737376,0.3838383838383838,0.3939393939393939,0.40404040404040403,0.41414141414141414,0.42424242424242425,0.43434343434343436,0.4444444444444444,0.45454545454545453,0.46464646464646464,0.47474747474747475,0.48484848484848486,0.494949494949495,0.5050505050505051,0.5151515151515151,0.5252525252525253,0.5353535353535354,0.5454545454545454,0.5555555555555556,0.5656565656565656,0.5757575757575758,0.5858585858585859,0.5959595959595959,0.6060606060606061,0.6161616161616161,0.6262626262626263,0.6363636363636364,0.6464646464646465,0.6565656565656566,0.6666666666666666,0.6767676767676768,0.6868686868686869,0.696969696969697,0.7070707070707071,0.7171717171717171,0.7272727272727273,0.7373737373737373,0.7474747474747475,0.7575757575757576,0.7676767676767676,0.7777777777777778,0.7878787878787878,0.797979797979798,0.8080808080808081,0.8181818181818182,0.8282828282828283,0.8383838383838383,0.8484848484848485,0.8585858585858586,0.8686868686868687,0.8787878787878788,0.8888888888888888,0.898989898989899,0.9090909090909091,0.9191919191919192,0.9292929292929293,0.9393939393939394,0.9494949494949495,0.9595959595959596,0.9696969696969697,0.9797979797979798,0.98989898989899,1.0],"y":[4.985260278731374,3.0874432275191563,3.3972016489193364,5.340430214080614,4.84939140925812,5.264099671432854,4.874897973344186,3.24666316080559,6.418532003675113,4.10269970055107,3.22607963519448,6.9286465295502175,6.60220630868308,3.918162471597847,4.353998313015342,6.120422018999019,4.354177621568017,6.451127876631009,5.299286923046604,3.5950081791074875,3.5191847559850222,5.579982268941464,4.264906044420247,6.5814201362368765,3.387217479360088,6.3475099590505195,3.18293709563756,6.398864168939883,3.5321769238475613,6.5506707424504285,3.1845772116153235,4.850056212189058,3.6877545118165616,4.750411872630684,3.825048717522888,6.681674431770485,4.110994667497957,3.2519304256490984,6.9677219383836135,3.0785984444136325,4.612229081893361,5.815282332276793,6.4340149605939345,6.288654851799476,4.90444994580589,6.016825295586715,5.463653689931737,3.669405349178485,5.855663316899501,3.0966764053759994,4.168615242751988,6.6310164646795595,3.320094110870127,4.5671650467380065,4.6659136337135285,6.259580954501862,3.06390826286996,3.239835890131329,3.046214425239702,3.188817145477507,6.658771643684373,6.907298201308798,5.088721775039201,4.047867208274941,3.506443299368494,4.282226176371097,6.1985829661552625,5.886242411918925,3.2268643050765444,4.14847592463216,5.8064981572551755,4.207388156735084,4.770211560726222,5.399461251683309,3.6821934162866543,3.446494133512351,3.8157286180194525,4.845679660832243,6.296786986186008,4.05760784222344,3.75791699188679,6.3583784276916075,4.780602098940033,6.210800301711789,3.469591976580151,4.165701607580827,3.6247190750056553,3.359023818567346,5.915268591013065,6.683734646031894,5.157390490231853,6.130298749562275,6.020151526591644,3.244925017508474,6.772772136714833,3.3727209619298524,5.357675313391696,3.1935158799933725,6.859906129567399,3.9455453819319524],"type":"scatter","mode":"markers"},{"x":[0.0,0.010101010101010102,0.020202020202020204,0.030303030303030304,0.04040404040404041,0.050505050505050504,0.06060606060606061,0.0707070707070707,0.08080808080808081,0.09090909090909091,0.10101010101010101,0.1111111111111111,0.12121212121212122,0.13131313131313133,0.1414141414141414,0.15151515151515152,0.16161616161616163,0.1717171717171717,0.18181818181818182,0.1919191919191919,0.20202020202020202,0.21212121212121213,0.2222222222222222,0.23232323232323232,0.24242424242424243,0.25252525252525254,0.26262626262626265,0.2727272727272727,0.2828282828282828,0.29292929292929293,0.30303030303030304,0.31313131313131315,0.32323232323232326,0.3333333333333333,0.3434343434343434,0.35353535353535354,0.36363636363636365,0.37373737373737376,0.3838383838383838,0.3939393939393939,0.40404040404040403,0.41414141414141414,0.42424242424242425,0.43434343434343436,0.4444444444444444,0.45454545454545453,0.46464646464646464,0.47474747474747475,0.48484848484848486,0.494949494949495,0.5050505050505051,0.5151515151515151,0.5252525252525253,0.5353535353535354,0.5454545454545454,0.5555555555555556,0.5656565656565656,0.5757575757575758,0.5858585858585859,0.5959595959595959,0.6060606060606061,0.6161616161616161,0.6262626262626263,0.6363636363636364,0.6464646464646465,0.6565656565656566,0.6666666666666666,0.6767676767676768,0.6868686868686869,0.696969696969697,0.7070707070707071,0.7171717171717171,0.7272727272727273,0.7373737373737373,0.7474747474747475,0.7575757575757576,0.7676767676767676,0.7777777777777778,0.7878787878787878,0.797979797979798,0.8080808080808081,0.8181818181818182,0.8282828282828283,0.8383838383838383,0.8484848484848485,0.8585858585858586,0.8686868686868687,0.8787878787878788,0.8888888888888888,0.898989898989899,0.9090909090909091,0.9191919191919192,0.9292929292929293,0.9393939393939394,0.9494949494949495,0.9595959595959596,0.9696969696969697,0.9797979797979798,0.98989898989899,1.0],"y":[0.1309014592531832,-0.12092090168873437,-0.24792347517937696,-0.38157421075531095,-0.3268019078778194,-0.19366233697162016,-0.443942179061388,0.037180599624911936,-0.14627691565755696,-0.009940677247018082,-0.30295374341626624,0.2152760719634741,0.16247660871789915,0.0243067480380591,0.22527302316542275,-0.33087714943701074,0.034610772960890435,-0.190052621893122,-0.4258484064183742,-0.4877942401819575,0.2985642587422195,-0.19553917306420288,-0.45996922341127533,0.1935371232359102,-0.1110200238228003,-0.36756262063299006,0.19073576501203782,-0.30942013373987065,-0.23889442087064194,-0.4179497735484513,0.41867798402743917,-0.2510924347444917,0.21331474800015482,0.2951128043964062,0.4939758438916475,-0.3425444801706504,-0.13043312817917285,0.05905557247221471,0.12799081569229065,-0.278165912650288,0.41746000291682406,0.04482934165047703,-0.4904984801013391,0.4337766385360333,0.2060303914860946,0.4915880482821098,-0.279123559700446,-0.314067421675878,0.4026829830395041,-0.36171593157990956,0.22107983735332337,-0.0024569242172961525,0.323562469238865,0.07726544536540714,0.3656573927439949,0.0933335987266064,-0.44089667224957174,-0.25751995133271965,-0.4573066253484245,-0.4234895410405297,-0.13232808952167863,0.43518980231278304,0.4636805518219457,0.22382575279867722,-0.3634747766701123,-0.2192793751684904,-0.48259545443432283,-0.3351177565952367,0.48825936616806076,0.4011710216988946,-0.12864238831313568,-0.3837269984936138,0.35605716212628435,-0.3507597046209584,0.025304456225202387,-0.28947014761445666,-0.18124159137582485,-0.2119513450098678,0.02563503800991984,-0.36412111416816695,0.3811872070883041,-0.4070236018007055,0.17014339006911772,0.0006250827619233013,-0.29327989852303793,-0.16916444426808042,0.08949126856044232,-0.15957277308698625,-0.31040096649182236,0.22869792441225412,0.13005457275494803,-0.3894224403157791,-0.06433757534720852,-0.3715771812369355,-0.17790893984091982,-0.24935490841902674,0.47839799712025044,-0.2920868208244508,0.14919724725216466,-0.3447312721260779],"type":"scatter","mode":"markers+lines"},{"x":[0.0,0.010101010101010102,0.020202020202020204,0.030303030303030304,0.04040404040404041,0.050505050505050504,0.06060606060606061,0.0707070707070707,0.08080808080808081,0.09090909090909091,0.10101010101010101,0.1111111111111111,0.12121212121212122,0.13131313131313133,0.1414141414141414,0.15151515151515152,0.16161616161616163,0.1717171717171717,0.18181818181818182,0.1919191919191919,0.20202020202020202,0.21212121212121213,0.2222222222222222,0.23232323232323232,0.24242424242424243,0.25252525252525254,0.26262626262626265,0.2727272727272727,0.2828282828282828,0.29292929292929293,0.30303030303030304,0.31313131313131315,0.32323232323232326,0.3333333333333333,0.3434343434343434,0.35353535353535354,0.36363636363636365,0.37373737373737376,0.3838383838383838,0.3939393939393939,0.40404040404040403,0.41414141414141414,0.42424242424242425,0.43434343434343436,0.4444444444444444,0.45454545454545453,0.46464646464646464,0.47474747474747475,0.48484848484848486,0.494949494949495,0.5050505050505051,0.5151515151515151,0.5252525252525253,0.5353535353535354,0.5454545454545454,0.5555555555555556,0.5656565656565656,0.5757575757575758,0.5858585858585859,0.5959595959595959,0.6060606060606061,0.6161616161616161,0.6262626262626263,0.6363636363636364,0.6464646464646465,0.6565656565656566,0.6666666666666666,0.6767676767676768,0.6868686868686869,0.696969696969697,0.7070707070707071,0.7171717171717171,0.7272727272727273,0.7373737373737373,0.7474747474747475,0.7575757575757576,0.7676767676767676,0.7777777777777778,0.7878787878787878,0.797979797979798,0.8080808080808081,0.8181818181818182,0.8282828282828283,0.8383838383838383,0.8484848484848485,0.8585858585858586,0.8686868686868687,0.8787878787878788,0.8888888888888888,0.898989898989899,0.9090909090909091,0.9191919191919192,0.9292929292929293,0.9393939393939394,0.9494949494949495,0.9595959595959596,0.9696969696969697,0.9797979797979798,0.98989898989899,1.0],"y":[-4.850161867044493,-6.529298593723915,-4.283662608506658,-6.314681662093851,-6.050516513315826,-3.858036644448656,-4.9070001095552485,-6.3564542837021385,-6.638664348900811,-5.90349375798998,-4.1305640139029265,-5.166049366054321,-5.764451117457858,-4.038721954302358,-4.201442855032376,-5.80838369971234,-4.576410299618151,-5.992096928585552,-4.171777328269329,-6.836138697659885,-3.8746472198376547,-6.061649837361388,-5.2225670056905305,-4.48421196750328,-5.1687895666830315,-4.733389716383817,-4.356347938419149,-6.856931276950129,-4.113147757502079,-5.485895098770774,-3.020410136368395,-3.6796149461924648,-6.219437228353254,-5.721443482731619,-6.785117041199607,-5.975056491697632,-5.471204319565711,-6.140815517115273,-3.85293459834377,-4.794751063696408,-6.066920624973463,-4.658937607273428,-4.244314248308864,-4.3971470841300775,-3.0923168906076284,-4.242304264335743,-5.439838990420933,-6.737356468998152,-5.377001572433954,-3.5597951953741256,-5.904159483068676,-3.509933212675735,-5.647333451731168,-6.980770761433191,-5.063107525457163,-5.821568004901666,-6.771735324253538,-5.104350502084778,-5.250133420020373,-4.0053444416532855,-4.5344135612264544,-5.7228381779994235,-3.2867472818330445,-5.632704098107777,-4.112679900174703,-4.83415250560498,-5.664356282933507,-5.082650295999196,-5.770278850609098,-4.339338917201653,-6.208149380940645,-4.773188987635924,-5.486441732188898,-6.202385879133556,-5.795322415836452,-6.5580505769761235,-4.309367416817603,-3.7426562949766202,-6.643914513422271,-4.2679522373526275,-4.069601714226939,-3.776273678565453,-3.9237792165603724,-4.131159951564035,-5.698210451262356,-4.889943528704039,-4.401683906908284,-3.0550959071601116,-3.9837697296933565,-3.4202492877982493,-4.168620192205498,-5.652088476243367,-5.005733690769526,-3.5110737185864433,-4.766172278699059,-6.947425491844378,-3.83414869405804,-6.087352017540812,-6.35484243665207,-5.464475440855368],"type":"scatter","mode":"lines"}],
96
+ {},
97
+ {"linkText":"Export to plot.ly","showLink":true}
98
+ )
99
+
100
+ window.addEventListener('resize', function() {
101
+ Plotly.Plots.resize(document.getElementById('083c5e64-9c4f-49a9-b994-1d1d19ed4dc2'))
102
+ })
103
+ })
104
+ </script>
105
+
106
+ <p>Last of all we add the x,y titles.</p>
107
+
108
+ <pre><code class="language-ruby">plot.layout.xaxis = { title: 'x title' }
109
+ plot.layout.yaxis = { title: 'y title' }
110
+ plot
111
+ </code></pre>
112
+ <script>
113
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
114
+ </script>
115
+ <div id="df72788b-4a73-4f79-80ff-0b7ba5956fe3" style="height: 100%; width: 100%;"></div>
116
+ <script>
117
+ require(['plotly'], function(Plotly) {
118
+ Plotly.newPlot(
119
+ 'df72788b-4a73-4f79-80ff-0b7ba5956fe3',
120
+ [{"x":[0.0,0.010101010101010102,0.020202020202020204,0.030303030303030304,0.04040404040404041,0.050505050505050504,0.06060606060606061,0.0707070707070707,0.08080808080808081,0.09090909090909091,0.10101010101010101,0.1111111111111111,0.12121212121212122,0.13131313131313133,0.1414141414141414,0.15151515151515152,0.16161616161616163,0.1717171717171717,0.18181818181818182,0.1919191919191919,0.20202020202020202,0.21212121212121213,0.2222222222222222,0.23232323232323232,0.24242424242424243,0.25252525252525254,0.26262626262626265,0.2727272727272727,0.2828282828282828,0.29292929292929293,0.30303030303030304,0.31313131313131315,0.32323232323232326,0.3333333333333333,0.3434343434343434,0.35353535353535354,0.36363636363636365,0.37373737373737376,0.3838383838383838,0.3939393939393939,0.40404040404040403,0.41414141414141414,0.42424242424242425,0.43434343434343436,0.4444444444444444,0.45454545454545453,0.46464646464646464,0.47474747474747475,0.48484848484848486,0.494949494949495,0.5050505050505051,0.5151515151515151,0.5252525252525253,0.5353535353535354,0.5454545454545454,0.5555555555555556,0.5656565656565656,0.5757575757575758,0.5858585858585859,0.5959595959595959,0.6060606060606061,0.6161616161616161,0.6262626262626263,0.6363636363636364,0.6464646464646465,0.6565656565656566,0.6666666666666666,0.6767676767676768,0.6868686868686869,0.696969696969697,0.7070707070707071,0.7171717171717171,0.7272727272727273,0.7373737373737373,0.7474747474747475,0.7575757575757576,0.7676767676767676,0.7777777777777778,0.7878787878787878,0.797979797979798,0.8080808080808081,0.8181818181818182,0.8282828282828283,0.8383838383838383,0.8484848484848485,0.8585858585858586,0.8686868686868687,0.8787878787878788,0.8888888888888888,0.898989898989899,0.9090909090909091,0.9191919191919192,0.9292929292929293,0.9393939393939394,0.9494949494949495,0.9595959595959596,0.9696969696969697,0.9797979797979798,0.98989898989899,1.0],"y":[4.985260278731374,3.0874432275191563,3.3972016489193364,5.340430214080614,4.84939140925812,5.264099671432854,4.874897973344186,3.24666316080559,6.418532003675113,4.10269970055107,3.22607963519448,6.9286465295502175,6.60220630868308,3.918162471597847,4.353998313015342,6.120422018999019,4.354177621568017,6.451127876631009,5.299286923046604,3.5950081791074875,3.5191847559850222,5.579982268941464,4.264906044420247,6.5814201362368765,3.387217479360088,6.3475099590505195,3.18293709563756,6.398864168939883,3.5321769238475613,6.5506707424504285,3.1845772116153235,4.850056212189058,3.6877545118165616,4.750411872630684,3.825048717522888,6.681674431770485,4.110994667497957,3.2519304256490984,6.9677219383836135,3.0785984444136325,4.612229081893361,5.815282332276793,6.4340149605939345,6.288654851799476,4.90444994580589,6.016825295586715,5.463653689931737,3.669405349178485,5.855663316899501,3.0966764053759994,4.168615242751988,6.6310164646795595,3.320094110870127,4.5671650467380065,4.6659136337135285,6.259580954501862,3.06390826286996,3.239835890131329,3.046214425239702,3.188817145477507,6.658771643684373,6.907298201308798,5.088721775039201,4.047867208274941,3.506443299368494,4.282226176371097,6.1985829661552625,5.886242411918925,3.2268643050765444,4.14847592463216,5.8064981572551755,4.207388156735084,4.770211560726222,5.399461251683309,3.6821934162866543,3.446494133512351,3.8157286180194525,4.845679660832243,6.296786986186008,4.05760784222344,3.75791699188679,6.3583784276916075,4.780602098940033,6.210800301711789,3.469591976580151,4.165701607580827,3.6247190750056553,3.359023818567346,5.915268591013065,6.683734646031894,5.157390490231853,6.130298749562275,6.020151526591644,3.244925017508474,6.772772136714833,3.3727209619298524,5.357675313391696,3.1935158799933725,6.859906129567399,3.9455453819319524],"type":"scatter","mode":"markers"},{"x":[0.0,0.010101010101010102,0.020202020202020204,0.030303030303030304,0.04040404040404041,0.050505050505050504,0.06060606060606061,0.0707070707070707,0.08080808080808081,0.09090909090909091,0.10101010101010101,0.1111111111111111,0.12121212121212122,0.13131313131313133,0.1414141414141414,0.15151515151515152,0.16161616161616163,0.1717171717171717,0.18181818181818182,0.1919191919191919,0.20202020202020202,0.21212121212121213,0.2222222222222222,0.23232323232323232,0.24242424242424243,0.25252525252525254,0.26262626262626265,0.2727272727272727,0.2828282828282828,0.29292929292929293,0.30303030303030304,0.31313131313131315,0.32323232323232326,0.3333333333333333,0.3434343434343434,0.35353535353535354,0.36363636363636365,0.37373737373737376,0.3838383838383838,0.3939393939393939,0.40404040404040403,0.41414141414141414,0.42424242424242425,0.43434343434343436,0.4444444444444444,0.45454545454545453,0.46464646464646464,0.47474747474747475,0.48484848484848486,0.494949494949495,0.5050505050505051,0.5151515151515151,0.5252525252525253,0.5353535353535354,0.5454545454545454,0.5555555555555556,0.5656565656565656,0.5757575757575758,0.5858585858585859,0.5959595959595959,0.6060606060606061,0.6161616161616161,0.6262626262626263,0.6363636363636364,0.6464646464646465,0.6565656565656566,0.6666666666666666,0.6767676767676768,0.6868686868686869,0.696969696969697,0.7070707070707071,0.7171717171717171,0.7272727272727273,0.7373737373737373,0.7474747474747475,0.7575757575757576,0.7676767676767676,0.7777777777777778,0.7878787878787878,0.797979797979798,0.8080808080808081,0.8181818181818182,0.8282828282828283,0.8383838383838383,0.8484848484848485,0.8585858585858586,0.8686868686868687,0.8787878787878788,0.8888888888888888,0.898989898989899,0.9090909090909091,0.9191919191919192,0.9292929292929293,0.9393939393939394,0.9494949494949495,0.9595959595959596,0.9696969696969697,0.9797979797979798,0.98989898989899,1.0],"y":[0.1309014592531832,-0.12092090168873437,-0.24792347517937696,-0.38157421075531095,-0.3268019078778194,-0.19366233697162016,-0.443942179061388,0.037180599624911936,-0.14627691565755696,-0.009940677247018082,-0.30295374341626624,0.2152760719634741,0.16247660871789915,0.0243067480380591,0.22527302316542275,-0.33087714943701074,0.034610772960890435,-0.190052621893122,-0.4258484064183742,-0.4877942401819575,0.2985642587422195,-0.19553917306420288,-0.45996922341127533,0.1935371232359102,-0.1110200238228003,-0.36756262063299006,0.19073576501203782,-0.30942013373987065,-0.23889442087064194,-0.4179497735484513,0.41867798402743917,-0.2510924347444917,0.21331474800015482,0.2951128043964062,0.4939758438916475,-0.3425444801706504,-0.13043312817917285,0.05905557247221471,0.12799081569229065,-0.278165912650288,0.41746000291682406,0.04482934165047703,-0.4904984801013391,0.4337766385360333,0.2060303914860946,0.4915880482821098,-0.279123559700446,-0.314067421675878,0.4026829830395041,-0.36171593157990956,0.22107983735332337,-0.0024569242172961525,0.323562469238865,0.07726544536540714,0.3656573927439949,0.0933335987266064,-0.44089667224957174,-0.25751995133271965,-0.4573066253484245,-0.4234895410405297,-0.13232808952167863,0.43518980231278304,0.4636805518219457,0.22382575279867722,-0.3634747766701123,-0.2192793751684904,-0.48259545443432283,-0.3351177565952367,0.48825936616806076,0.4011710216988946,-0.12864238831313568,-0.3837269984936138,0.35605716212628435,-0.3507597046209584,0.025304456225202387,-0.28947014761445666,-0.18124159137582485,-0.2119513450098678,0.02563503800991984,-0.36412111416816695,0.3811872070883041,-0.4070236018007055,0.17014339006911772,0.0006250827619233013,-0.29327989852303793,-0.16916444426808042,0.08949126856044232,-0.15957277308698625,-0.31040096649182236,0.22869792441225412,0.13005457275494803,-0.3894224403157791,-0.06433757534720852,-0.3715771812369355,-0.17790893984091982,-0.24935490841902674,0.47839799712025044,-0.2920868208244508,0.14919724725216466,-0.3447312721260779],"type":"scatter","mode":"markers+lines"},{"x":[0.0,0.010101010101010102,0.020202020202020204,0.030303030303030304,0.04040404040404041,0.050505050505050504,0.06060606060606061,0.0707070707070707,0.08080808080808081,0.09090909090909091,0.10101010101010101,0.1111111111111111,0.12121212121212122,0.13131313131313133,0.1414141414141414,0.15151515151515152,0.16161616161616163,0.1717171717171717,0.18181818181818182,0.1919191919191919,0.20202020202020202,0.21212121212121213,0.2222222222222222,0.23232323232323232,0.24242424242424243,0.25252525252525254,0.26262626262626265,0.2727272727272727,0.2828282828282828,0.29292929292929293,0.30303030303030304,0.31313131313131315,0.32323232323232326,0.3333333333333333,0.3434343434343434,0.35353535353535354,0.36363636363636365,0.37373737373737376,0.3838383838383838,0.3939393939393939,0.40404040404040403,0.41414141414141414,0.42424242424242425,0.43434343434343436,0.4444444444444444,0.45454545454545453,0.46464646464646464,0.47474747474747475,0.48484848484848486,0.494949494949495,0.5050505050505051,0.5151515151515151,0.5252525252525253,0.5353535353535354,0.5454545454545454,0.5555555555555556,0.5656565656565656,0.5757575757575758,0.5858585858585859,0.5959595959595959,0.6060606060606061,0.6161616161616161,0.6262626262626263,0.6363636363636364,0.6464646464646465,0.6565656565656566,0.6666666666666666,0.6767676767676768,0.6868686868686869,0.696969696969697,0.7070707070707071,0.7171717171717171,0.7272727272727273,0.7373737373737373,0.7474747474747475,0.7575757575757576,0.7676767676767676,0.7777777777777778,0.7878787878787878,0.797979797979798,0.8080808080808081,0.8181818181818182,0.8282828282828283,0.8383838383838383,0.8484848484848485,0.8585858585858586,0.8686868686868687,0.8787878787878788,0.8888888888888888,0.898989898989899,0.9090909090909091,0.9191919191919192,0.9292929292929293,0.9393939393939394,0.9494949494949495,0.9595959595959596,0.9696969696969697,0.9797979797979798,0.98989898989899,1.0],"y":[-4.850161867044493,-6.529298593723915,-4.283662608506658,-6.314681662093851,-6.050516513315826,-3.858036644448656,-4.9070001095552485,-6.3564542837021385,-6.638664348900811,-5.90349375798998,-4.1305640139029265,-5.166049366054321,-5.764451117457858,-4.038721954302358,-4.201442855032376,-5.80838369971234,-4.576410299618151,-5.992096928585552,-4.171777328269329,-6.836138697659885,-3.8746472198376547,-6.061649837361388,-5.2225670056905305,-4.48421196750328,-5.1687895666830315,-4.733389716383817,-4.356347938419149,-6.856931276950129,-4.113147757502079,-5.485895098770774,-3.020410136368395,-3.6796149461924648,-6.219437228353254,-5.721443482731619,-6.785117041199607,-5.975056491697632,-5.471204319565711,-6.140815517115273,-3.85293459834377,-4.794751063696408,-6.066920624973463,-4.658937607273428,-4.244314248308864,-4.3971470841300775,-3.0923168906076284,-4.242304264335743,-5.439838990420933,-6.737356468998152,-5.377001572433954,-3.5597951953741256,-5.904159483068676,-3.509933212675735,-5.647333451731168,-6.980770761433191,-5.063107525457163,-5.821568004901666,-6.771735324253538,-5.104350502084778,-5.250133420020373,-4.0053444416532855,-4.5344135612264544,-5.7228381779994235,-3.2867472818330445,-5.632704098107777,-4.112679900174703,-4.83415250560498,-5.664356282933507,-5.082650295999196,-5.770278850609098,-4.339338917201653,-6.208149380940645,-4.773188987635924,-5.486441732188898,-6.202385879133556,-5.795322415836452,-6.5580505769761235,-4.309367416817603,-3.7426562949766202,-6.643914513422271,-4.2679522373526275,-4.069601714226939,-3.776273678565453,-3.9237792165603724,-4.131159951564035,-5.698210451262356,-4.889943528704039,-4.401683906908284,-3.0550959071601116,-3.9837697296933565,-3.4202492877982493,-4.168620192205498,-5.652088476243367,-5.005733690769526,-3.5110737185864433,-4.766172278699059,-6.947425491844378,-3.83414869405804,-6.087352017540812,-6.35484243665207,-5.464475440855368],"type":"scatter","mode":"lines"}],
121
+ {"xaxis":{"title":"x title"},"yaxis":{"title":"y title"}},
122
+ {"linkText":"Export to plot.ly","showLink":true}
123
+ )
124
+
125
+ window.addEventListener('resize', function() {
126
+ Plotly.Plots.resize(document.getElementById('df72788b-4a73-4f79-80ff-0b7ba5956fe3'))
127
+ })
128
+ })
129
+ </script>
130
+
131
+
132
+ </article>
133
+ </body>
134
+ </html>
@@ -0,0 +1,43 @@
1
+ # rbplotly basic usage
2
+
3
+
4
+ ~~~ruby
5
+ require 'rbplotly'
6
+
7
+ n = 100
8
+
9
+ x = n.times.map { |i| i.to_f / (n - 1) }
10
+ y0 = n.times.map { rand(-2.0..2.0) + 5 }
11
+ y1 = n.times.map { rand(-2.0..2.0) }
12
+
13
+ trace0 = { x: x, y: y0, type: :scatter, mode: :markers }
14
+ trace1 = trace0.merge(y: y1, mode: :'markers+lines')
15
+
16
+ plot = Plotly::Plot.new(data: [trace0, trace1])
17
+ ~~~
18
+
19
+ Here we replace the last trace range from -0.5 to 0.5
20
+
21
+
22
+ ~~~ruby
23
+ plot.data.last.y = n.times.map { rand(-0.5..0.5) }
24
+ plot
25
+ ~~~
26
+
27
+ Next we add a line trace with the center -5 and the range from -2.0 to 2.0.
28
+
29
+ ~~~ruby
30
+ new_trace = { x: x, y: n.times.map { rand(-2.0..2.0) - 5 }, type: :scatter, mode: :lines }
31
+ plot.data.push(new_trace)
32
+ plot
33
+ ~~~
34
+
35
+ Last of all we add the x,y titles.
36
+
37
+
38
+ ~~~ruby
39
+ plot.layout.xaxis = { title: 'x title' }
40
+ plot.layout.yaxis = { title: 'y title' }
41
+ plot
42
+ ~~~
43
+
@@ -0,0 +1,136 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <link href='https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.min.css' rel='stylesheet' type='text/css' />
6
+ <style>
7
+ article.markdown-body {
8
+ box-sizing: border-box;
9
+ min-width: 200px;
10
+ max-width: 980px;
11
+ margin: 0 auto;
12
+ padding: 45px;
13
+ }
14
+
15
+ span.line-numbers {
16
+ display: none;
17
+ }
18
+ </style>
19
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
20
+ </head>
21
+ <body>
22
+ <article class='markdown-body'>
23
+ <h1 id="rbplotly-boxplot-usage">rbplotly boxplot usage</h1>
24
+
25
+ <pre><code class="language-ruby">require 'rbplotly'
26
+
27
+ n = 50
28
+ y0 = n.times.map { rand(-1.0..0.0) }
29
+ y1 = n.times.map { rand(0.0..1.0) }
30
+
31
+ trace0 = {
32
+ y: y0,
33
+ type: :box
34
+ }
35
+
36
+ trace1 = {
37
+ y: y1,
38
+ type: :box
39
+ }
40
+
41
+ data = [trace0, trace1]
42
+
43
+ plot = Plotly::Plot.new(data: data)
44
+ </code></pre>
45
+ <script>
46
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
47
+ </script>
48
+ <div id="64c16c23-cf4e-4091-9367-fbd10fd5d48c" style="height: 100%; width: 100%;"></div>
49
+ <script>
50
+ require(['plotly'], function(Plotly) {
51
+ Plotly.newPlot(
52
+ '64c16c23-cf4e-4091-9367-fbd10fd5d48c',
53
+ [{"y":[-0.6001427516289052,-0.026959427615898313,-0.4864155421869234,-0.29493510223097186,-0.9394095382141759,-0.760028342149393,-0.40857901017562803,-0.1139307194815733,-0.06390844728533507,-0.20771392024973778,-0.48163315369355053,-0.36400202627078204,-0.06864228340418721,-0.34922441527199166,-0.5407005035975675,-0.6860083987048076,-0.8667258110133939,-0.5615511170502011,-0.42223973534150416,-0.46919516257452865,-0.13529536815775411,-0.1583287450386599,-0.4521509538515214,-0.3508791601651685,-0.2478471684030923,-0.5219461305684557,-0.7915098658013134,-0.5220844372426872,-0.5385654566709819,-0.36787219887970557,-0.2440704941577867,-0.491388367825232,-0.7162852541210145,-0.8193158328694417,-0.9763103423998325,-0.8417700405546519,-0.17067864582948822,-0.9657560014214285,-0.32148320315892587,-0.5172418675515075,-0.5000108466371888,-0.5526524560645119,-0.9424020962997811,-0.26770388774184806,-0.42170822418102205,-0.9322102895914618,-0.1046134266837917,-0.5746805858557265,-0.7842795376319152,-0.05703056233776416],"type":"box"},{"y":[0.0819063398957327,0.8988591772521235,0.9297037716684377,0.6363427956654196,0.7725420978545925,0.023347809401973785,0.9640535798799938,0.6747255805069022,0.6652994189386187,0.35183108980553035,0.7562805105827332,0.5037835097069013,0.5233756377036157,0.4431792649557217,0.2852101276528638,0.04959529314051636,0.8119211078497929,0.17636497034519683,0.013280007481948353,0.04970176050779196,0.6742864276881929,0.6734014597928628,0.05906668431886397,0.15386864706345682,0.5382668322669225,0.14358008795761068,0.5600183886930822,0.7971804216103904,0.2058391788677546,0.6319081465557655,0.7616697267139567,0.9951880279811385,0.5276041097664292,0.4227867206017579,0.45854830469138597,0.7930685643001116,0.1491358996259764,0.40129899585556006,0.16500835406627468,0.02711567569041473,0.3714924400928856,0.37553552220945385,0.22735868214574295,0.8157483662957069,0.5076573382876599,0.9095021442510196,0.7334884519678616,0.2662564994051353,0.5350890283185609,0.3832189384311919],"type":"box"}],
54
+ {},
55
+ {"linkText":"Export to plot.ly","showLink":true}
56
+ )
57
+
58
+ window.addEventListener('resize', function() {
59
+ Plotly.Plots.resize(document.getElementById('64c16c23-cf4e-4091-9367-fbd10fd5d48c'))
60
+ })
61
+ })
62
+ </script>
63
+
64
+ <h2 id="horizontal-boxplot">Horizontal boxplot</h2>
65
+
66
+ <pre><code class="language-ruby">n = 50
67
+ x0 = n.times.map { rand(-1.0..0.0) }
68
+ x1 = n.times.map { rand(0.0..1.0) }
69
+
70
+ trace0 = {
71
+ x: x0,
72
+ type: :box
73
+ }
74
+
75
+ trace1 = {
76
+ x: x1,
77
+ type: :box
78
+ }
79
+
80
+ data = [trace0, trace1]
81
+
82
+ plot = Plotly::Plot.new(data: data)
83
+ </code></pre>
84
+ <script>
85
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
86
+ </script>
87
+ <div id="54e94d56-21d0-485b-9dcc-8f40cf769a79" style="height: 100%; width: 100%;"></div>
88
+ <script>
89
+ require(['plotly'], function(Plotly) {
90
+ Plotly.newPlot(
91
+ '54e94d56-21d0-485b-9dcc-8f40cf769a79',
92
+ [{"type":"box","x":[-0.3205033932609489,-0.26238569962994596,-0.8901998942458936,-0.4071878521925232,-0.8428232882438274,-0.5311365043040361,-0.04243827540696343,-0.6454825343679634,-0.6560493325152996,-0.26246268108587223,-0.6263482812535422,-0.4194275128327042,-0.9381219792551476,-0.7929588374965849,-0.5896929293919331,-0.26063147790253915,-0.5439750586134059,-0.8130159944936789,-0.9439254391464975,-0.8427757676056397,-0.2786691308898206,-0.4286437220585717,-0.25725299177521155,-0.7792427376103574,-0.5968112798034733,-0.3130268975393695,-0.5614988180945063,-0.45809368506589054,-0.4103384018167089,-0.8789808235944037,-0.5222193549772519,-0.7281232086336703,-0.5719993816192728,-0.542962498408286,-0.23220403873375395,-0.8641328552555391,-0.976945192890142,-0.47531854757488734,-0.8059929176474002,-0.7225407097956621,-0.31945557052330664,-0.321248649198149,-0.5971912973723836,-0.005562508620817752,-0.9064163596935066,-0.9761465605404751,-0.010095872984686172,-0.3748688206589287,-0.3503996735267024,-0.8474599755414098]},{"type":"box","x":[0.5650961314020684,0.9554732003821282,0.4495006613665521,0.4955487528044583,0.12639608991660178,0.8350272542330541,0.9139100102058548,0.15474965104532457,0.9118811333865261,0.8768473564385958,0.43190143086170873,0.2941612507549981,0.7893597121644989,0.16960010296771666,0.1269449999358857,0.559964625827519,0.39285590656616354,0.5431641977500735,0.5434194927244664,0.9112770502904594,0.1250707806827619,0.6887544533068989,0.552133535393763,0.917067045278301,0.26536335236444497,0.5947319094411597,0.29874527643927784,0.27691514839415743,0.7143500962574125,0.38673637404247774,0.9882875011704102,0.32068722871703137,0.03431326169771143,0.6264032389313177,0.5982060010805625,0.6854438344279872,0.24356968525578127,0.825647462754238,0.8587936128143032,0.2259034211301021,0.03429043570803059,0.5315130798262732,0.3502091425174395,0.562707545824969,0.1354375776432154,0.2510350438891623,0.15107011438734608,0.4396786173449372,0.28239739221118987,0.0849851435239537]}],
93
+ {},
94
+ {"linkText":"Export to plot.ly","showLink":true}
95
+ )
96
+
97
+ window.addEventListener('resize', function() {
98
+ Plotly.Plots.resize(document.getElementById('54e94d56-21d0-485b-9dcc-8f40cf769a79'))
99
+ })
100
+ })
101
+ </script>
102
+
103
+ <h2 id="boxplot-with-the-points">boxplot with the points</h2>
104
+
105
+ <pre><code class="language-ruby">trace = {
106
+ y: [0, 1, 1, 2, 3, 5, 8, 13, 21],
107
+ boxpoints: :all,
108
+ jitter: 0.3,
109
+ pointpos: -1.8,
110
+ type: :box
111
+ }
112
+
113
+ plot = Plotly::Plot.new(data: [trace])
114
+ </code></pre>
115
+ <script>
116
+ requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min'] }})
117
+ </script>
118
+ <div id="70b03350-bcee-44dc-b9bc-0a71b8bf3995" style="height: 100%; width: 100%;"></div>
119
+ <script>
120
+ require(['plotly'], function(Plotly) {
121
+ Plotly.newPlot(
122
+ '70b03350-bcee-44dc-b9bc-0a71b8bf3995',
123
+ [{"y":[0,1,1,2,3,5,8,13,21],"type":"box","boxpoints":"all","jitter":0.3,"pointpos":-1.8}],
124
+ {},
125
+ {"linkText":"Export to plot.ly","showLink":true}
126
+ )
127
+
128
+ window.addEventListener('resize', function() {
129
+ Plotly.Plots.resize(document.getElementById('70b03350-bcee-44dc-b9bc-0a71b8bf3995'))
130
+ })
131
+ })
132
+ </script>
133
+
134
+ </article>
135
+ </body>
136
+ </html>