charty 0.1.5.dev → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +71 -0
- data/.github/workflows/nmatrix.yml +67 -0
- data/.github/workflows/pycall.yml +86 -0
- data/Dockerfile.dev +9 -1
- data/Gemfile +18 -0
- data/README.md +176 -9
- data/Rakefile +4 -5
- data/charty.gemspec +10 -1
- data/examples/Gemfile +1 -0
- data/examples/active_record.ipynb +1 -1
- data/examples/daru.ipynb +1 -1
- data/examples/iris_dataset.ipynb +1 -1
- data/examples/nmatrix.ipynb +1 -1
- data/examples/{numo-narray.ipynb → numo_narray.ipynb} +1 -1
- data/examples/palette.rb +71 -0
- data/examples/sample.png +0 -0
- data/examples/sample_bokeh.ipynb +156 -0
- data/examples/sample_google_chart.ipynb +229 -68
- data/examples/sample_images/bar_bokeh.html +85 -0
- data/examples/sample_images/barh_bokeh.html +85 -0
- data/examples/sample_images/box_plot_bokeh.html +85 -0
- data/examples/sample_images/curve_bokeh.html +85 -0
- data/examples/sample_images/curve_with_function_bokeh.html +85 -0
- data/examples/sample_images/hist_gruff.png +0 -0
- data/examples/sample_images/scatter_bokeh.html +85 -0
- data/examples/sample_pyplot.ipynb +40 -38
- data/images/penguins_body_mass_g_flipper_length_mm_scatter_plot.png +0 -0
- data/images/penguins_body_mass_g_flipper_length_mm_species_scatter_plot.png +0 -0
- data/images/penguins_body_mass_g_flipper_length_mm_species_sex_scatter_plot.png +0 -0
- data/images/penguins_species_body_mass_g_bar_plot_h.png +0 -0
- data/images/penguins_species_body_mass_g_bar_plot_v.png +0 -0
- data/images/penguins_species_body_mass_g_box_plot_h.png +0 -0
- data/images/penguins_species_body_mass_g_box_plot_v.png +0 -0
- data/images/penguins_species_body_mass_g_sex_bar_plot_v.png +0 -0
- data/images/penguins_species_body_mass_g_sex_box_plot_v.png +0 -0
- data/lib/charty.rb +14 -1
- data/lib/charty/backend_methods.rb +8 -0
- data/lib/charty/backends.rb +80 -0
- data/lib/charty/backends/bokeh.rb +32 -26
- data/lib/charty/backends/google_charts.rb +267 -0
- data/lib/charty/backends/gruff.rb +102 -83
- data/lib/charty/backends/plotly.rb +685 -0
- data/lib/charty/backends/pyplot.rb +586 -92
- data/lib/charty/backends/rubyplot.rb +82 -74
- data/lib/charty/backends/unicode_plot.rb +79 -0
- data/lib/charty/index.rb +213 -0
- data/lib/charty/linspace.rb +1 -1
- data/lib/charty/missing_value_support.rb +14 -0
- data/lib/charty/plot_methods.rb +184 -0
- data/lib/charty/plotter.rb +48 -40
- data/lib/charty/plotters.rb +11 -0
- data/lib/charty/plotters/abstract_plotter.rb +183 -0
- data/lib/charty/plotters/bar_plotter.rb +201 -0
- data/lib/charty/plotters/box_plotter.rb +79 -0
- data/lib/charty/plotters/categorical_plotter.rb +380 -0
- data/lib/charty/plotters/count_plotter.rb +7 -0
- data/lib/charty/plotters/estimation_support.rb +84 -0
- data/lib/charty/plotters/random_support.rb +25 -0
- data/lib/charty/plotters/relational_plotter.rb +518 -0
- data/lib/charty/plotters/scatter_plotter.rb +104 -0
- data/lib/charty/plotters/vector_plotter.rb +6 -0
- data/lib/charty/statistics.rb +114 -0
- data/lib/charty/table.rb +80 -3
- data/lib/charty/table_adapters.rb +25 -0
- data/lib/charty/table_adapters/active_record_adapter.rb +63 -0
- data/lib/charty/table_adapters/base_adapter.rb +69 -0
- data/lib/charty/table_adapters/daru_adapter.rb +70 -0
- data/lib/charty/table_adapters/datasets_adapter.rb +49 -0
- data/lib/charty/table_adapters/hash_adapter.rb +224 -0
- data/lib/charty/table_adapters/narray_adapter.rb +76 -0
- data/lib/charty/table_adapters/nmatrix_adapter.rb +67 -0
- data/lib/charty/table_adapters/pandas_adapter.rb +81 -0
- data/lib/charty/util.rb +20 -0
- data/lib/charty/vector.rb +69 -0
- data/lib/charty/vector_adapters.rb +183 -0
- data/lib/charty/vector_adapters/array_adapter.rb +109 -0
- data/lib/charty/vector_adapters/daru_adapter.rb +171 -0
- data/lib/charty/vector_adapters/narray_adapter.rb +187 -0
- data/lib/charty/vector_adapters/nmatrix_adapter.rb +37 -0
- data/lib/charty/vector_adapters/numpy_adapter.rb +168 -0
- data/lib/charty/vector_adapters/pandas_adapter.rb +200 -0
- data/lib/charty/version.rb +1 -1
- metadata +179 -10
- data/.travis.yml +0 -11
- data/lib/charty/backends/google_chart.rb +0 -167
- data/lib/charty/plotter_adapter.rb +0 -17
data/Rakefile
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
t.test_files = FileList['test/**/*_test.rb']
|
4
|
+
desc "Run tests"
|
5
|
+
task :test do
|
6
|
+
ruby("test/run.rb")
|
8
7
|
end
|
9
8
|
|
10
|
-
task :
|
9
|
+
task default: :test
|
data/charty.gemspec
CHANGED
@@ -26,8 +26,17 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
|
+
spec.add_dependency "red-colors"
|
30
|
+
spec.add_dependency "red-palette", ">= 0.2.0"
|
31
|
+
|
29
32
|
spec.add_development_dependency "bundler", ">= 1.16"
|
30
33
|
spec.add_development_dependency "rake"
|
31
34
|
spec.add_development_dependency "test-unit"
|
32
|
-
spec.add_development_dependency "
|
35
|
+
spec.add_development_dependency "red-datasets", ">= 0.0.9"
|
36
|
+
spec.add_development_dependency "daru"
|
37
|
+
spec.add_development_dependency "matrix" # need for daru on Ruby > 3.0
|
38
|
+
spec.add_development_dependency "activerecord"
|
39
|
+
spec.add_development_dependency "sqlite3"
|
40
|
+
spec.add_development_dependency "playwright-ruby-client"
|
41
|
+
spec.add_development_dependency "iruby"
|
33
42
|
end
|
data/examples/Gemfile
CHANGED
data/examples/daru.ipynb
CHANGED
data/examples/iris_dataset.ipynb
CHANGED
data/examples/nmatrix.ipynb
CHANGED
data/examples/palette.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require "charty"
|
4
|
+
|
5
|
+
Palette.default = ARGV[0] if ARGV[0]
|
6
|
+
|
7
|
+
charty = Charty::Plotter.new(:pyplot)
|
8
|
+
figure = charty.bar do
|
9
|
+
series [1, 2, 3, 4, 5], [10, 20, 25, 30, 40], label: "a"
|
10
|
+
series [1, 2, 3, 4, 5], [20, 10, 15, 20, 50], label: "b"
|
11
|
+
series [1, 2, 3, 4, 5], [30, 25, 20, 10, 5], label: "cd"
|
12
|
+
end
|
13
|
+
figure.save("bar_sample.png")
|
14
|
+
|
15
|
+
figure = charty.barh do
|
16
|
+
series [1, 2, 3, 4, 5], [10, 20, 25, 30, 40], label: "a"
|
17
|
+
series [1, 2, 3, 4, 5], [20, 10, 15, 20, 50], label: "b"
|
18
|
+
series [1, 2, 3, 4, 5], [30, 25, 20, 10, 5], label: "cd"
|
19
|
+
end
|
20
|
+
figure.save("barh_sample.png")
|
21
|
+
|
22
|
+
figure = charty.curve do
|
23
|
+
series [1, 2, 3, 4, 5], [10, 20, 25, 30, 40], label: "a"
|
24
|
+
series [1, 2, 3, 4, 5], [20, 10, 15, 20, 50], label: "b"
|
25
|
+
series [1, 2, 3, 4, 5], [30, 25, 20, 10, 5], label: "cd"
|
26
|
+
end
|
27
|
+
figure.save("curve_sample.png")
|
28
|
+
|
29
|
+
figure = charty.box_plot do
|
30
|
+
data [
|
31
|
+
[1, 3, 7, *Array.new(20) { rand(40..70) }, 100, 110, 120],
|
32
|
+
[1, 4, 7, *Array.new(80) { rand(35..80) }, 130, 135, 145],
|
33
|
+
[0, 2, 8, *Array.new(20) { rand(60..90) }, 150, 160, 165]
|
34
|
+
]
|
35
|
+
xlabel "foo"
|
36
|
+
ylabel "bar"
|
37
|
+
title "box plot"
|
38
|
+
end
|
39
|
+
figure.save("box_plot_sample.png")
|
40
|
+
|
41
|
+
figure = charty.scatter do
|
42
|
+
series 0..10, (0..1).step(0.1), label: 'sample1'
|
43
|
+
series 0..5, (0..1).step(0.2), label: 'sample2'
|
44
|
+
series [0, 1, 2, 3, 4], [0, -0.1, -0.5, -0.5, 0.1]
|
45
|
+
end
|
46
|
+
figure.save("scatter_sample.png")
|
47
|
+
|
48
|
+
figure = charty.bubble do
|
49
|
+
series 0..10, (0..1).step(0.1), [10, 100, 1000, 20, 200, 2000, 5, 50, 500, 4, 40], label: 'sample1'
|
50
|
+
series 0..5, (0..1).step(0.2), [1, 10, 100, 1000, 500, 100], label: 'sample2'
|
51
|
+
series [0, 1, 2, 3, 4], [0, -0.1, -0.5, -0.5, 0.1], [40, 30, 200, 10, 5]
|
52
|
+
range x: 0..10, y: -1..1
|
53
|
+
xlabel 'x label'
|
54
|
+
ylabel 'y label'
|
55
|
+
title 'bubble sample'
|
56
|
+
end
|
57
|
+
figure.save("bubble_sample.png")
|
58
|
+
|
59
|
+
def randn(n, mu=0.0, sigma=1.0)
|
60
|
+
Array.new(n) do
|
61
|
+
x, y = rand, rand
|
62
|
+
sigma * Math.sqrt(-2 * Math.log(x)) * Math.cos(2 * Math::PI * y) + mu
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
figure = charty.hist do
|
67
|
+
data [ randn(1000, 0.0, 1.0),
|
68
|
+
randn(100, 2.0, 2.0) ]
|
69
|
+
title "histogram sample"
|
70
|
+
end
|
71
|
+
figure.save("hist_sample.png")
|
data/examples/sample.png
ADDED
Binary file
|
@@ -0,0 +1,156 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": 43,
|
6
|
+
"metadata": {
|
7
|
+
"scrolled": false
|
8
|
+
},
|
9
|
+
"outputs": [
|
10
|
+
{
|
11
|
+
"data": {
|
12
|
+
"text/plain": [
|
13
|
+
"#<Charty::Plotter:0x000055fbc356dcf8 @plotter_adapter=#<Charty::Bokeh:0x000055fbc356dbb8 @plot=<module 'bokeh.plotting' from '/opt/conda/lib/python3.7/site-packages/bokeh/plotting/__init__.py'>>>"
|
14
|
+
]
|
15
|
+
},
|
16
|
+
"execution_count": 43,
|
17
|
+
"metadata": {},
|
18
|
+
"output_type": "execute_result"
|
19
|
+
}
|
20
|
+
],
|
21
|
+
"source": [
|
22
|
+
"require 'charty'\n",
|
23
|
+
"\n",
|
24
|
+
"charty = Charty::Plotter.new(:bokeh)"
|
25
|
+
]
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"cell_type": "code",
|
29
|
+
"execution_count": 44,
|
30
|
+
"metadata": {},
|
31
|
+
"outputs": [],
|
32
|
+
"source": [
|
33
|
+
"curve = charty.curve do\n",
|
34
|
+
" function {|x| Math.sin(x) }\n",
|
35
|
+
" range x: 0..10, y: -1..1\n",
|
36
|
+
" xlabel 'foo'\n",
|
37
|
+
" ylabel 'bar'\n",
|
38
|
+
"end\n",
|
39
|
+
"curve.render(\"sample_images/curve_with_function_bokeh.html\")"
|
40
|
+
]
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"cell_type": "code",
|
44
|
+
"execution_count": 45,
|
45
|
+
"metadata": {},
|
46
|
+
"outputs": [],
|
47
|
+
"source": [
|
48
|
+
"curve2 = charty.curve do\n",
|
49
|
+
" series [0,1,2,3,4], [10,40,20,90,70]\n",
|
50
|
+
" series [0,1,2,3,4], [90,80,70,60,50]\n",
|
51
|
+
" series [0,1,2,3,4,5,6,7,8], [50,60,20,30,10, 90, 0, 100, 50]\n",
|
52
|
+
" range x: 0..10, y: 1..100\n",
|
53
|
+
" xlabel 'foo'\n",
|
54
|
+
" ylabel 'bar'\n",
|
55
|
+
"end\n",
|
56
|
+
"curve2.render(\"sample_images/curve_bokeh.html\")"
|
57
|
+
]
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"cell_type": "code",
|
61
|
+
"execution_count": 46,
|
62
|
+
"metadata": {},
|
63
|
+
"outputs": [],
|
64
|
+
"source": [
|
65
|
+
"bar = charty.bar do\n",
|
66
|
+
" series [0,1,2,3,4], [10,40,20,90,70]\n",
|
67
|
+
" series [0,1,2,3,4], [90,80,70,60,50]\n",
|
68
|
+
" series [0,1,2,3,4,5,6,7,8], [50,60,20,30,10, 90, 0, 100, 50]\n",
|
69
|
+
" range x: 0..10, y: 1..100\n",
|
70
|
+
" xlabel 'foo'\n",
|
71
|
+
" ylabel 'bar'\n",
|
72
|
+
" title 'bar plot'\n",
|
73
|
+
"end\n",
|
74
|
+
"bar.render(\"sample_images/bar_bokeh.html\")"
|
75
|
+
]
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"cell_type": "code",
|
79
|
+
"execution_count": 47,
|
80
|
+
"metadata": {},
|
81
|
+
"outputs": [],
|
82
|
+
"source": [
|
83
|
+
"barh = charty.barh do\n",
|
84
|
+
" series [0,1,2,3,4], [10,40,20,90,70]\n",
|
85
|
+
" series [0,1,2,3,4], [90,80,70,60,50]\n",
|
86
|
+
" series [0,1,2,3,4,5,6,7,8], [50,60,20,30,10, 90, 0, 100, 50]\n",
|
87
|
+
" range x: 0..10, y: 1..100\n",
|
88
|
+
" xlabel 'foo'\n",
|
89
|
+
" ylabel 'bar'\n",
|
90
|
+
" title 'bar plot'\n",
|
91
|
+
"end\n",
|
92
|
+
"barh.render(\"sample_images/barh_bokeh.html\")"
|
93
|
+
]
|
94
|
+
},
|
95
|
+
{
|
96
|
+
"cell_type": "code",
|
97
|
+
"execution_count": 48,
|
98
|
+
"metadata": {},
|
99
|
+
"outputs": [],
|
100
|
+
"source": [
|
101
|
+
"box_plot = charty.box_plot do\n",
|
102
|
+
" data [[60,70,80,70,50], [100,40,20,80,70], [30, 10]]\n",
|
103
|
+
" range x: 0..10, y: 1..100\n",
|
104
|
+
" xlabel 'foo'\n",
|
105
|
+
" ylabel 'bar'\n",
|
106
|
+
" title 'box plot'\n",
|
107
|
+
"end\n",
|
108
|
+
"box_plot.render(\"sample_images/box_plot_bokeh.html\")"
|
109
|
+
]
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"cell_type": "code",
|
113
|
+
"execution_count": 49,
|
114
|
+
"metadata": {},
|
115
|
+
"outputs": [],
|
116
|
+
"source": [
|
117
|
+
"scatter = charty.scatter do\n",
|
118
|
+
" series 0..10, (0..1).step(0.1), label: 'sample1'\n",
|
119
|
+
" series 0..5, (0..1).step(0.2), label: 'sample2'\n",
|
120
|
+
" series [0, 1, 2, 3, 4], [0, -0.1, -0.5, -0.5, 0.1]\n",
|
121
|
+
" range x: 0..10, y: -1..1\n",
|
122
|
+
" # xlabel 'x label'\n",
|
123
|
+
" # xlabel ''\n",
|
124
|
+
" ylabel 'y label'\n",
|
125
|
+
" title 'scatter sample'\n",
|
126
|
+
"end\n",
|
127
|
+
"scatter.render(\"sample_images/scatter_bokeh.html\")"
|
128
|
+
]
|
129
|
+
}
|
130
|
+
],
|
131
|
+
"metadata": {
|
132
|
+
"kernelspec": {
|
133
|
+
"display_name": "Ruby 2.6.2",
|
134
|
+
"language": "ruby",
|
135
|
+
"name": "ruby"
|
136
|
+
},
|
137
|
+
"language_info": {
|
138
|
+
"file_extension": ".rb",
|
139
|
+
"mimetype": "application/x-ruby",
|
140
|
+
"name": "ruby",
|
141
|
+
"version": "2.6.2"
|
142
|
+
},
|
143
|
+
"toc": {
|
144
|
+
"nav_menu": {},
|
145
|
+
"number_sections": true,
|
146
|
+
"sideBar": true,
|
147
|
+
"skip_h1_title": false,
|
148
|
+
"toc_cell": false,
|
149
|
+
"toc_position": {},
|
150
|
+
"toc_section_display": "block",
|
151
|
+
"toc_window_display": false
|
152
|
+
}
|
153
|
+
},
|
154
|
+
"nbformat": 4,
|
155
|
+
"nbformat_minor": 2
|
156
|
+
}
|
@@ -4,111 +4,285 @@
|
|
4
4
|
"cell_type": "code",
|
5
5
|
"execution_count": 1,
|
6
6
|
"metadata": {},
|
7
|
+
"outputs": [],
|
8
|
+
"source": [
|
9
|
+
"require 'charty'\n",
|
10
|
+
"charty = Charty::Plotter.new(:google_chart)\n",
|
11
|
+
"nil"
|
12
|
+
]
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"cell_type": "code",
|
16
|
+
"execution_count": 2,
|
17
|
+
"metadata": {},
|
7
18
|
"outputs": [
|
8
19
|
{
|
9
20
|
"data": {
|
21
|
+
"text/html": [
|
22
|
+
" <script type='text/javascript' src='https://www.gstatic.com/charts/loader.js'></script>\n",
|
23
|
+
" <script type=\"text/javascript\">\n",
|
24
|
+
" google.charts.load(\"current\", {packages:[\"corechart\"]});\n",
|
25
|
+
" google.charts.setOnLoadCallback(drawChart);\n",
|
26
|
+
" function drawChart() {\n",
|
27
|
+
" const data = new google.visualization.DataTable();\n",
|
28
|
+
" data.addColumn('number', 'foo');data.addColumn('number', '0');\n",
|
29
|
+
" data.addRows([[0.0, 0.0], [0.1, 0.09983341664682815], [0.2, 0.19866933079506122], [0.30000000000000004, 0.2955202066613396], [0.4, 0.3894183423086505], [0.5, 0.479425538604203], [0.6000000000000001, 0.5646424733950355], [0.7000000000000001, 0.6442176872376911], [0.8, 0.7173560908995228], [0.9, 0.7833269096274834], [1.0, 0.8414709848078965], [1.1, 0.8912073600614354], [1.2000000000000002, 0.9320390859672264], [1.3, 0.963558185417193], [1.4000000000000001, 0.9854497299884603], [1.5, 0.9974949866040544], [1.6, 0.9995736030415051], [1.7000000000000002, 0.9916648104524686], [1.8, 0.9738476308781951], [1.9000000000000001, 0.9463000876874145], [2.0, 0.9092974268256817], [2.1, 0.8632093666488737], [2.2, 0.8084964038195901], [2.3000000000000003, 0.74570521217672], [2.4000000000000004, 0.6754631805511506], [2.5, 0.5984721441039565], [2.6, 0.5155013718214642], [2.7, 0.4273798802338298], [2.8000000000000003, 0.33498815015590466], [2.9000000000000004, 0.23924932921398198], [3.0, 0.1411200080598672], [3.1, 0.04158066243329049], [3.2, -0.058374143427580086], [3.3000000000000003, -0.15774569414324865], [3.4000000000000004, -0.25554110202683167], [3.5, -0.35078322768961984], [3.6, -0.44252044329485246], [3.7, -0.5298361409084934], [3.8000000000000003, -0.6118578909427193], [3.9000000000000004, -0.6877661591839741], [4.0, -0.7568024953079282], [4.1000000000000005, -0.8182771110644108], [4.2, -0.8715757724135882], [4.3, -0.9161659367494549], [4.4, -0.951602073889516], [4.5, -0.977530117665097], [4.6000000000000005, -0.9936910036334645], [4.7, -0.9999232575641008], [4.800000000000001, -0.9961646088358406], [4.9, -0.9824526126243325], [5.0, -0.9589242746631385], [5.1000000000000005, -0.9258146823277321], [5.2, -0.8834546557201531], [5.300000000000001, -0.8322674422239008], [5.4, -0.7727644875559871], [5.5, -0.7055403255703919], [5.6000000000000005, -0.6312666378723208], [5.7, -0.5506855425976376], [5.800000000000001, -0.4646021794137566], [5.9, -0.373876664830236], [6.0, -0.27941549819892586], [6.1000000000000005, -0.18216250427209502], [6.2, -0.0830894028174964], [6.300000000000001, 0.0168139004843506], [6.4, 0.11654920485049364], [6.5, 0.21511998808781552], [6.6000000000000005, 0.3115413635133787], [6.7, 0.4048499206165983], [6.800000000000001, 0.49411335113860894], [6.9, 0.5784397643882001], [7.0, 0.6569865987187891], [7.1000000000000005, 0.7289690401258765], [7.2, 0.7936678638491531], [7.300000000000001, 0.8504366206285648], [7.4, 0.8987080958116269], [7.5, 0.9379999767747389], [7.6000000000000005, 0.9679196720314865], [7.7, 0.9881682338770004], [7.800000000000001, 0.998543345374605], [7.9, 0.998941341839772], [8.0, 0.9893582466233818], [8.1, 0.9698898108450863], [8.200000000000001, 0.9407305566797726], [8.3, 0.9021718337562933], [8.4, 0.8545989080882804], [8.5, 0.7984871126234903], [8.6, 0.7343970978741133], [8.700000000000001, 0.662969230082182], [8.8, 0.5849171928917617], [8.9, 0.5010208564578846], [9.0, 0.4121184852417566], [9.1, 0.3190983623493521], [9.200000000000001, 0.22288991410024592], [9.3, 0.1244544235070617], [9.4, 0.024775425453357765], [9.5, -0.0751511204618093], [9.600000000000001, -0.1743267812229814], [9.700000000000001, -0.2717606264109442], [9.8, -0.3664791292519284], [10, -0.5440211108893698]])\n",
|
30
|
+
"\n",
|
31
|
+
" const view = new google.visualization.DataView(data);\n",
|
32
|
+
"\n",
|
33
|
+
" const options = {\n",
|
34
|
+
" title: \"\",\n",
|
35
|
+
" vAxis: {\n",
|
36
|
+
" title: \"bar\",\n",
|
37
|
+
" viewWindow: {\n",
|
38
|
+
" max: 1,\n",
|
39
|
+
" min: -1,\n",
|
40
|
+
" },\n",
|
41
|
+
" },\n",
|
42
|
+
" hAxis: {\n",
|
43
|
+
" title: \"foo\",\n",
|
44
|
+
" viewWindow: {\n",
|
45
|
+
" max: 10,\n",
|
46
|
+
" min: 0,\n",
|
47
|
+
" }\n",
|
48
|
+
" },\n",
|
49
|
+
" legend: { position: \"none\" },\n",
|
50
|
+
" };\n",
|
51
|
+
" const chart = new google.visualization.LineChart(document.getElementById(\"LineChart-1\"));\n",
|
52
|
+
" chart.draw(view, options);\n",
|
53
|
+
" }\n",
|
54
|
+
" </script>\n",
|
55
|
+
" <div id=\"LineChart-1\" style=\"width: 900px; height: 300px;\"></div>\n"
|
56
|
+
],
|
10
57
|
"text/plain": [
|
11
|
-
"
|
58
|
+
"\" <script type='text/javascript' src='https://www.gstatic.com/charts/loader.js'></script>\\n <script type=\\\"text/javascript\\\">\\n google.charts.load(\\\"current\\\", {packages:[\\\"corechart\\\"]});\\n google.charts.setOnLoadCallback(drawChart);\\n function drawChart() {\\n const data = new google.visualization.DataTable();\\n data.addColumn('number', 'foo');data.addColumn('number', '0');\\n data.addRows([[0.0, 0.0], [0.1, 0.09983341664682815], [0.2, 0.19866933079506122], [0.30000000000000004, 0.2955202066613396], [0.4, 0.3894183423086505], [0.5, 0.479425538604203], [0.6000000000000001, 0.5646424733950355], [0.7000000000000001, 0.6442176872376911], [0.8, 0.7173560908995228], [0.9, 0.7833269096274834], [1.0, 0.8414709848078965], [1.1, 0.8912073600614354], [1.2000000000000002, 0.9320390859672264], [1.3, 0.963558185417193], [1.4000000000000001, 0.9854497299884603], [1.5, 0.9974949866040544], [1.6, 0.9995736030415051], [1.7000000000000002, 0.9916648104524686], [1.8, 0.9738476308781951], [1.9000000000000001, 0.9463000876874145], [2.0, 0.9092974268256817], [2.1, 0.8632093666488737], [2.2, 0.8084964038195901], [2.3000000000000003, 0.74570521217672], [2.4000000000000004, 0.6754631805511506], [2.5, 0.5984721441039565], [2.6, 0.5155013718214642], [2.7, 0.4273798802338298], [2.8000000000000003, 0.33498815015590466], [2.9000000000000004, 0.23924932921398198], [3.0, 0.1411200080598672], [3.1, 0.04158066243329049], [3.2, -0.058374143427580086], [3.3000000000000003, -0.15774569414324865], [3.4000000000000004, -0.25554110202683167], [3.5, -0.35078322768961984], [3.6, -0.44252044329485246], [3.7, -0.5298361409084934], [3.8000000000000003, -0.6118578909427193], [3.9000000000000004, -0.6877661591839741], [4.0, -0.7568024953079282], [4.1000000000000005, -0.8182771110644108], [4.2, -0.8715757724135882], [4.3, -0.9161659367494549], [4.4, -0.951602073889516], [4.5, -0.977530117665097], [4.6000000000000005, -0.9936910036334645], [4.7, -0.9999232575641008], [4.800000000000001, -0.9961646088358406], [4.9, -0.9824526126243325], [5.0, -0.9589242746631385], [5.1000000000000005, -0.9258146823277321], [5.2, -0.8834546557201531], [5.300000000000001, -0.8322674422239008], [5.4, -0.7727644875559871], [5.5, -0.7055403255703919], [5.6000000000000005, -0.6312666378723208], [5.7, -0.5506855425976376], [5.800000000000001, -0.4646021794137566], [5.9, -0.373876664830236], [6.0, -0.27941549819892586], [6.1000000000000005, -0.18216250427209502], [6.2, -0.0830894028174964], [6.300000000000001, 0.0168139004843506], [6.4, 0.11654920485049364], [6.5, 0.21511998808781552], [6.6000000000000005, 0.3115413635133787], [6.7, 0.4048499206165983], [6.800000000000001, 0.49411335113860894], [6.9, 0.5784397643882001], [7.0, 0.6569865987187891], [7.1000000000000005, 0.7289690401258765], [7.2, 0.7936678638491531], [7.300000000000001, 0.8504366206285648], [7.4, 0.8987080958116269], [7.5, 0.9379999767747389], [7.6000000000000005, 0.9679196720314865], [7.7, 0.9881682338770004], [7.800000000000001, 0.998543345374605], [7.9, 0.998941341839772], [8.0, 0.9893582466233818], [8.1, 0.9698898108450863], [8.200000000000001, 0.9407305566797726], [8.3, 0.9021718337562933], [8.4, 0.8545989080882804], [8.5, 0.7984871126234903], [8.6, 0.7343970978741133], [8.700000000000001, 0.662969230082182], [8.8, 0.5849171928917617], [8.9, 0.5010208564578846], [9.0, 0.4121184852417566], [9.1, 0.3190983623493521], [9.200000000000001, 0.22288991410024592], [9.3, 0.1244544235070617], [9.4, 0.024775425453357765], [9.5, -0.0751511204618093], [9.600000000000001, -0.1743267812229814], [9.700000000000001, -0.2717606264109442], [9.8, -0.3664791292519284], [10, -0.5440211108893698]])\\n\\n const view = new google.visualization.DataView(data);\\n\\n const options = {\\n title: \\\"\\\",\\n vAxis: {\\n title: \\\"bar\\\",\\n viewWindow: {\\n max: 1,\\n min: -1,\\n },\\n },\\n hAxis: {\\n title: \\\"foo\\\",\\n viewWindow: {\\n max: 10,\\n min: 0,\\n }\\n },\\n legend: { position: \\\"none\\\" },\\n };\\n const chart = new google.visualization.LineChart(document.getElementById(\\\"LineChart-1\\\"));\\n chart.draw(view, options);\\n }\\n </script>\\n <div id=\\\"LineChart-1\\\" style=\\\"width: 900px; height: 300px;\\\"></div>\\n\""
|
12
59
|
]
|
13
60
|
},
|
14
|
-
"execution_count": 1,
|
15
61
|
"metadata": {},
|
16
|
-
"output_type": "
|
62
|
+
"output_type": "display_data"
|
17
63
|
}
|
18
64
|
],
|
19
65
|
"source": [
|
20
|
-
"
|
21
|
-
"
|
66
|
+
"curve = charty.curve do\n",
|
67
|
+
" function {|x| Math.sin(x) }\n",
|
68
|
+
" range x: 0..10, y: -1..1\n",
|
69
|
+
" xlabel 'foo'\n",
|
70
|
+
" ylabel 'bar'\n",
|
71
|
+
"end\n",
|
72
|
+
"IRuby.display(IRuby.html(curve.render))\n",
|
73
|
+
"nil"
|
22
74
|
]
|
23
75
|
},
|
24
76
|
{
|
25
77
|
"cell_type": "code",
|
26
|
-
"execution_count":
|
78
|
+
"execution_count": 3,
|
27
79
|
"metadata": {},
|
28
80
|
"outputs": [
|
29
81
|
{
|
30
82
|
"data": {
|
31
83
|
"text/html": [
|
32
|
-
"
|
84
|
+
" \n",
|
33
85
|
" <script type=\"text/javascript\">\n",
|
34
86
|
" google.charts.load(\"current\", {packages:[\"corechart\"]});\n",
|
35
87
|
" google.charts.setOnLoadCallback(drawChart);\n",
|
36
88
|
" function drawChart() {\n",
|
37
|
-
" const data = google.visualization.
|
38
|
-
"
|
39
|
-
" )
|
89
|
+
" const data = new google.visualization.DataTable();\n",
|
90
|
+
" data.addColumn('number', 'foo');data.addColumn('number', '0');data.addColumn('number', '1');data.addColumn('number', '2');\n",
|
91
|
+
" data.addRows([[0, 10, 90, 50], [1, 40, 80, 60], [2, 20, 70, 20], [3, 90, 60, 30], [4, 70, 50, 10], [5, null, null, 90], [6, null, null, 0], [7, null, null, 100], [8, null, null, 50]])\n",
|
40
92
|
"\n",
|
41
93
|
" const view = new google.visualization.DataView(data);\n",
|
42
94
|
"\n",
|
43
95
|
" const options = {\n",
|
44
|
-
" title: \"
|
96
|
+
" title: \"\",\n",
|
45
97
|
" vAxis: {\n",
|
46
|
-
" title: \"
|
98
|
+
" title: \"bar\",\n",
|
47
99
|
" viewWindow: {\n",
|
48
|
-
" max:
|
49
|
-
" min:
|
100
|
+
" max: 100,\n",
|
101
|
+
" min: 1,\n",
|
50
102
|
" },\n",
|
51
103
|
" },\n",
|
52
104
|
" hAxis: {\n",
|
53
105
|
" title: \"foo\",\n",
|
54
106
|
" viewWindow: {\n",
|
55
|
-
" max:
|
56
|
-
" min:
|
107
|
+
" max: 10,\n",
|
108
|
+
" min: 0,\n",
|
57
109
|
" }\n",
|
58
110
|
" },\n",
|
59
111
|
" legend: { position: \"none\" },\n",
|
60
112
|
" };\n",
|
61
|
-
" const chart = new google.visualization.
|
113
|
+
" const chart = new google.visualization.LineChart(document.getElementById(\"LineChart-2\"));\n",
|
62
114
|
" chart.draw(view, options);\n",
|
63
115
|
" }\n",
|
64
116
|
" </script>\n",
|
65
|
-
" <div id=\"
|
117
|
+
" <div id=\"LineChart-2\" style=\"width: 900px; height: 300px;\"></div>\n"
|
66
118
|
],
|
67
119
|
"text/plain": [
|
68
|
-
"\"
|
120
|
+
"\" \\n <script type=\\\"text/javascript\\\">\\n google.charts.load(\\\"current\\\", {packages:[\\\"corechart\\\"]});\\n google.charts.setOnLoadCallback(drawChart);\\n function drawChart() {\\n const data = new google.visualization.DataTable();\\n data.addColumn('number', 'foo');data.addColumn('number', '0');data.addColumn('number', '1');data.addColumn('number', '2');\\n data.addRows([[0, 10, 90, 50], [1, 40, 80, 60], [2, 20, 70, 20], [3, 90, 60, 30], [4, 70, 50, 10], [5, null, null, 90], [6, null, null, 0], [7, null, null, 100], [8, null, null, 50]])\\n\\n const view = new google.visualization.DataView(data);\\n\\n const options = {\\n title: \\\"\\\",\\n vAxis: {\\n title: \\\"bar\\\",\\n viewWindow: {\\n max: 100,\\n min: 1,\\n },\\n },\\n hAxis: {\\n title: \\\"foo\\\",\\n viewWindow: {\\n max: 10,\\n min: 0,\\n }\\n },\\n legend: { position: \\\"none\\\" },\\n };\\n const chart = new google.visualization.LineChart(document.getElementById(\\\"LineChart-2\\\"));\\n chart.draw(view, options);\\n }\\n </script>\\n <div id=\\\"LineChart-2\\\" style=\\\"width: 900px; height: 300px;\\\"></div>\\n\""
|
69
121
|
]
|
70
122
|
},
|
71
123
|
"metadata": {},
|
72
124
|
"output_type": "display_data"
|
73
|
-
}
|
125
|
+
}
|
126
|
+
],
|
127
|
+
"source": [
|
128
|
+
"curve2 = charty.curve do\n",
|
129
|
+
" series [0,1,2,3,4], [10,40,20,90,70]\n",
|
130
|
+
" series [0,1,2,3,4], [90,80,70,60,50]\n",
|
131
|
+
" series [0,1,2,3,4,5,6,7,8], [50,60,20,30,10, 90, 0, 100, 50]\n",
|
132
|
+
" range x: 0..10, y: 1..100\n",
|
133
|
+
" xlabel 'foo'\n",
|
134
|
+
" ylabel 'bar'\n",
|
135
|
+
"end\n",
|
136
|
+
"IRuby.display(IRuby.html(curve2.render))\n",
|
137
|
+
"nil"
|
138
|
+
]
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"cell_type": "code",
|
142
|
+
"execution_count": 4,
|
143
|
+
"metadata": {},
|
144
|
+
"outputs": [
|
74
145
|
{
|
75
146
|
"data": {
|
147
|
+
"text/html": [
|
148
|
+
" \n",
|
149
|
+
" <script type=\"text/javascript\">\n",
|
150
|
+
" google.charts.load(\"current\", {packages:[\"corechart\"]});\n",
|
151
|
+
" google.charts.setOnLoadCallback(drawChart);\n",
|
152
|
+
" function drawChart() {\n",
|
153
|
+
" const data = new google.visualization.DataTable();\n",
|
154
|
+
" data.addColumn('string', 'foo');data.addColumn('number', '0');data.addColumn('number', '1');data.addColumn('number', '2');\n",
|
155
|
+
" data.addRows([[\"0\", 10, 90, 50], [\"1\", 40, 80, 60], [\"2\", 20, 70, 20], [\"3\", 90, 60, 30], [\"4\", 70, 50, 10], [\"5\", null, null, 90], [\"6\", null, null, 0], [\"7\", null, null, 100], [\"8\", null, null, 50]])\n",
|
156
|
+
"\n",
|
157
|
+
" const view = new google.visualization.DataView(data);\n",
|
158
|
+
"\n",
|
159
|
+
" const options = {\n",
|
160
|
+
" title: \"bar plot\",\n",
|
161
|
+
" vAxis: {\n",
|
162
|
+
" title: \"bar\",\n",
|
163
|
+
" viewWindow: {\n",
|
164
|
+
" max: 100,\n",
|
165
|
+
" min: 1,\n",
|
166
|
+
" },\n",
|
167
|
+
" },\n",
|
168
|
+
" hAxis: {\n",
|
169
|
+
" title: \"foo\",\n",
|
170
|
+
" viewWindow: {\n",
|
171
|
+
" max: 10,\n",
|
172
|
+
" min: 0,\n",
|
173
|
+
" }\n",
|
174
|
+
" },\n",
|
175
|
+
" legend: { position: \"none\" },\n",
|
176
|
+
" };\n",
|
177
|
+
" const chart = new google.visualization.ColumnChart(document.getElementById(\"ColumnChart-3\"));\n",
|
178
|
+
" chart.draw(view, options);\n",
|
179
|
+
" }\n",
|
180
|
+
" </script>\n",
|
181
|
+
" <div id=\"ColumnChart-3\" style=\"width: 900px; height: 300px;\"></div>\n"
|
182
|
+
],
|
76
183
|
"text/plain": [
|
77
|
-
"
|
184
|
+
"\" \\n <script type=\\\"text/javascript\\\">\\n google.charts.load(\\\"current\\\", {packages:[\\\"corechart\\\"]});\\n google.charts.setOnLoadCallback(drawChart);\\n function drawChart() {\\n const data = new google.visualization.DataTable();\\n data.addColumn('string', 'foo');data.addColumn('number', '0');data.addColumn('number', '1');data.addColumn('number', '2');\\n data.addRows([[\\\"0\\\", 10, 90, 50], [\\\"1\\\", 40, 80, 60], [\\\"2\\\", 20, 70, 20], [\\\"3\\\", 90, 60, 30], [\\\"4\\\", 70, 50, 10], [\\\"5\\\", null, null, 90], [\\\"6\\\", null, null, 0], [\\\"7\\\", null, null, 100], [\\\"8\\\", null, null, 50]])\\n\\n const view = new google.visualization.DataView(data);\\n\\n const options = {\\n title: \\\"bar plot\\\",\\n vAxis: {\\n title: \\\"bar\\\",\\n viewWindow: {\\n max: 100,\\n min: 1,\\n },\\n },\\n hAxis: {\\n title: \\\"foo\\\",\\n viewWindow: {\\n max: 10,\\n min: 0,\\n }\\n },\\n legend: { position: \\\"none\\\" },\\n };\\n const chart = new google.visualization.ColumnChart(document.getElementById(\\\"ColumnChart-3\\\"));\\n chart.draw(view, options);\\n }\\n </script>\\n <div id=\\\"ColumnChart-3\\\" style=\\\"width: 900px; height: 300px;\\\"></div>\\n\""
|
78
185
|
]
|
79
186
|
},
|
80
|
-
"execution_count": 2,
|
81
187
|
"metadata": {},
|
82
|
-
"output_type": "
|
188
|
+
"output_type": "display_data"
|
83
189
|
}
|
84
190
|
],
|
85
191
|
"source": [
|
86
192
|
"bar = charty.bar do\n",
|
193
|
+
" series [0,1,2,3,4], [10,40,20,90,70]\n",
|
194
|
+
" series [0,1,2,3,4], [90,80,70,60,50]\n",
|
195
|
+
" series [0,1,2,3,4,5,6,7,8], [50,60,20,30,10, 90, 0, 100, 50]\n",
|
196
|
+
" range x: 0..10, y: 1..100\n",
|
87
197
|
" xlabel 'foo'\n",
|
88
|
-
" ylabel '
|
89
|
-
"
|
90
|
-
" series [0, 1, 2], [30, 40, 50]\n",
|
91
|
-
" title 'this is the title'\n",
|
198
|
+
" ylabel 'bar'\n",
|
199
|
+
" title 'bar plot'\n",
|
92
200
|
"end\n",
|
93
|
-
"IRuby.display(IRuby.html(bar.render))"
|
201
|
+
"IRuby.display(IRuby.html(bar.render))\n",
|
202
|
+
"nil"
|
94
203
|
]
|
95
204
|
},
|
96
205
|
{
|
97
206
|
"cell_type": "code",
|
98
|
-
"execution_count":
|
207
|
+
"execution_count": 5,
|
99
208
|
"metadata": {},
|
100
209
|
"outputs": [
|
101
210
|
{
|
102
211
|
"data": {
|
103
212
|
"text/html": [
|
104
|
-
"
|
213
|
+
" \n",
|
214
|
+
" <script type=\"text/javascript\">\n",
|
215
|
+
" google.charts.load(\"current\", {packages:[\"corechart\"]});\n",
|
216
|
+
" google.charts.setOnLoadCallback(drawChart);\n",
|
217
|
+
" function drawChart() {\n",
|
218
|
+
" const data = new google.visualization.DataTable();\n",
|
219
|
+
" data.addColumn('string', 'foo');data.addColumn('number', '0');data.addColumn('number', '1');data.addColumn('number', '2');\n",
|
220
|
+
" data.addRows([[\"4\", 70, null, 10], [\"123412341234\", 10, null, null], [\"1234523452345\", 40, null, null], [\"234563456345634\", 20, null, null], [\"3456745674567\", 90, null, null], [\"a\", null, 90, null], [\"b\", null, 80, null], [\"c\", null, 70, null], [\"d\", null, 60, null], [\"e\", null, 50, null], [\"0\", null, null, 50], [\"1\", null, null, 60], [\"2\", null, null, 20], [\"3\", null, null, 30], [\"5\", null, null, 90], [\"6\", null, null, 0], [\"7\", null, null, 100], [\"8\", null, null, 50]])\n",
|
221
|
+
"\n",
|
222
|
+
" const view = new google.visualization.DataView(data);\n",
|
223
|
+
"\n",
|
224
|
+
" const options = {\n",
|
225
|
+
" title: \"bar plot\",\n",
|
226
|
+
" vAxis: {\n",
|
227
|
+
" title: \"bar\",\n",
|
228
|
+
" viewWindow: {\n",
|
229
|
+
" max: 10,\n",
|
230
|
+
" min: 0,\n",
|
231
|
+
" },\n",
|
232
|
+
" },\n",
|
233
|
+
" hAxis: {\n",
|
234
|
+
" title: \"foo\",\n",
|
235
|
+
" viewWindow: {\n",
|
236
|
+
" max: 100,\n",
|
237
|
+
" min: 1,\n",
|
238
|
+
" }\n",
|
239
|
+
" },\n",
|
240
|
+
" legend: { position: \"none\" },\n",
|
241
|
+
" };\n",
|
242
|
+
" const chart = new google.visualization.BarChart(document.getElementById(\"BarChart-4\"));\n",
|
243
|
+
" chart.draw(view, options);\n",
|
244
|
+
" }\n",
|
245
|
+
" </script>\n",
|
246
|
+
" <div id=\"BarChart-4\" style=\"width: 900px; height: 300px;\"></div>\n"
|
247
|
+
],
|
248
|
+
"text/plain": [
|
249
|
+
"\" \\n <script type=\\\"text/javascript\\\">\\n google.charts.load(\\\"current\\\", {packages:[\\\"corechart\\\"]});\\n google.charts.setOnLoadCallback(drawChart);\\n function drawChart() {\\n const data = new google.visualization.DataTable();\\n data.addColumn('string', 'foo');data.addColumn('number', '0');data.addColumn('number', '1');data.addColumn('number', '2');\\n data.addRows([[\\\"4\\\", 70, null, 10], [\\\"123412341234\\\", 10, null, null], [\\\"1234523452345\\\", 40, null, null], [\\\"234563456345634\\\", 20, null, null], [\\\"3456745674567\\\", 90, null, null], [\\\"a\\\", null, 90, null], [\\\"b\\\", null, 80, null], [\\\"c\\\", null, 70, null], [\\\"d\\\", null, 60, null], [\\\"e\\\", null, 50, null], [\\\"0\\\", null, null, 50], [\\\"1\\\", null, null, 60], [\\\"2\\\", null, null, 20], [\\\"3\\\", null, null, 30], [\\\"5\\\", null, null, 90], [\\\"6\\\", null, null, 0], [\\\"7\\\", null, null, 100], [\\\"8\\\", null, null, 50]])\\n\\n const view = new google.visualization.DataView(data);\\n\\n const options = {\\n title: \\\"bar plot\\\",\\n vAxis: {\\n title: \\\"bar\\\",\\n viewWindow: {\\n max: 10,\\n min: 0,\\n },\\n },\\n hAxis: {\\n title: \\\"foo\\\",\\n viewWindow: {\\n max: 100,\\n min: 1,\\n }\\n },\\n legend: { position: \\\"none\\\" },\\n };\\n const chart = new google.visualization.BarChart(document.getElementById(\\\"BarChart-4\\\"));\\n chart.draw(view, options);\\n }\\n </script>\\n <div id=\\\"BarChart-4\\\" style=\\\"width: 900px; height: 300px;\\\"></div>\\n\""
|
250
|
+
]
|
251
|
+
},
|
252
|
+
"metadata": {},
|
253
|
+
"output_type": "display_data"
|
254
|
+
}
|
255
|
+
],
|
256
|
+
"source": [
|
257
|
+
"barh = charty.barh do\n",
|
258
|
+
" series [123412341234,1234523452345,234563456345634,3456745674567,\"4\"], [10,40,20,90,70]\n",
|
259
|
+
" series [\"a\",\"b\",\"c\",\"d\",\"e\"], [90,80,70,60,50]\n",
|
260
|
+
" series [\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\"], [50,60,20,30,10, 90, 0, 100, 50]\n",
|
261
|
+
" range x: 0..10, y: 1..100\n",
|
262
|
+
" xlabel 'foo'\n",
|
263
|
+
" ylabel 'bar'\n",
|
264
|
+
" title 'bar plot'\n",
|
265
|
+
"end\n",
|
266
|
+
"IRuby.display(IRuby.html(barh.render))\n",
|
267
|
+
"nil"
|
268
|
+
]
|
269
|
+
},
|
270
|
+
{
|
271
|
+
"cell_type": "code",
|
272
|
+
"execution_count": 6,
|
273
|
+
"metadata": {},
|
274
|
+
"outputs": [
|
275
|
+
{
|
276
|
+
"data": {
|
277
|
+
"text/html": [
|
278
|
+
" \n",
|
105
279
|
" <script type=\"text/javascript\">\n",
|
106
280
|
" google.charts.load(\"current\", {packages:[\"corechart\"]});\n",
|
107
281
|
" google.charts.setOnLoadCallback(drawChart);\n",
|
108
282
|
" function drawChart() {\n",
|
109
|
-
" const data = google.visualization.
|
110
|
-
"
|
111
|
-
" )
|
283
|
+
" const data = new google.visualization.DataTable();\n",
|
284
|
+
" data.addColumn('string', '');data.addColumn('number', 'sample1');data.addColumn('number', 'sample2');data.addColumn('number', '2');\n",
|
285
|
+
" data.addRows([[\"0\", 0.0, 0.0, 0], [\"1\", 0.1, 0.2, -0.1], [\"2\", 0.2, 0.4, -0.5], [\"3\", 0.30000000000000004, 0.6000000000000001, -0.5], [\"4\", 0.4, 0.8, 0.1], [\"5\", 0.5, 1.0, null], [\"6\", 0.6000000000000001, null, null], [\"7\", 0.7000000000000001, null, null], [\"8\", 0.8, null, null], [\"9\", 0.9, null, null], [\"10\", 1.0, null, null]])\n",
|
112
286
|
"\n",
|
113
287
|
" const view = new google.visualization.DataView(data);\n",
|
114
288
|
"\n",
|
@@ -130,28 +304,18 @@
|
|
130
304
|
" },\n",
|
131
305
|
" legend: { position: \"none\" },\n",
|
132
306
|
" };\n",
|
133
|
-
" const chart = new google.visualization.ScatterChart(document.getElementById(\"ScatterChart-
|
307
|
+
" const chart = new google.visualization.ScatterChart(document.getElementById(\"ScatterChart-5\"));\n",
|
134
308
|
" chart.draw(view, options);\n",
|
135
309
|
" }\n",
|
136
310
|
" </script>\n",
|
137
|
-
" <div id=\"ScatterChart-
|
311
|
+
" <div id=\"ScatterChart-5\" style=\"width: 900px; height: 300px;\"></div>\n"
|
138
312
|
],
|
139
313
|
"text/plain": [
|
140
|
-
"\"
|
314
|
+
"\" \\n <script type=\\\"text/javascript\\\">\\n google.charts.load(\\\"current\\\", {packages:[\\\"corechart\\\"]});\\n google.charts.setOnLoadCallback(drawChart);\\n function drawChart() {\\n const data = new google.visualization.DataTable();\\n data.addColumn('string', '');data.addColumn('number', 'sample1');data.addColumn('number', 'sample2');data.addColumn('number', '2');\\n data.addRows([[\\\"0\\\", 0.0, 0.0, 0], [\\\"1\\\", 0.1, 0.2, -0.1], [\\\"2\\\", 0.2, 0.4, -0.5], [\\\"3\\\", 0.30000000000000004, 0.6000000000000001, -0.5], [\\\"4\\\", 0.4, 0.8, 0.1], [\\\"5\\\", 0.5, 1.0, null], [\\\"6\\\", 0.6000000000000001, null, null], [\\\"7\\\", 0.7000000000000001, null, null], [\\\"8\\\", 0.8, null, null], [\\\"9\\\", 0.9, null, null], [\\\"10\\\", 1.0, null, null]])\\n\\n const view = new google.visualization.DataView(data);\\n\\n const options = {\\n title: \\\"scatter sample\\\",\\n vAxis: {\\n title: \\\"y label\\\",\\n viewWindow: {\\n max: null,\\n min: null,\\n },\\n },\\n hAxis: {\\n title: \\\"\\\",\\n viewWindow: {\\n max: null,\\n min: null,\\n }\\n },\\n legend: { position: \\\"none\\\" },\\n };\\n const chart = new google.visualization.ScatterChart(document.getElementById(\\\"ScatterChart-5\\\"));\\n chart.draw(view, options);\\n }\\n </script>\\n <div id=\\\"ScatterChart-5\\\" style=\\\"width: 900px; height: 300px;\\\"></div>\\n\""
|
141
315
|
]
|
142
316
|
},
|
143
317
|
"metadata": {},
|
144
318
|
"output_type": "display_data"
|
145
|
-
},
|
146
|
-
{
|
147
|
-
"data": {
|
148
|
-
"text/plain": [
|
149
|
-
"#<CZTop::Socket::PUB:0x7fc4430de3c0 last_endpoint=\"tcp://127.0.0.1:49318\">"
|
150
|
-
]
|
151
|
-
},
|
152
|
-
"execution_count": 3,
|
153
|
-
"metadata": {},
|
154
|
-
"output_type": "execute_result"
|
155
319
|
}
|
156
320
|
],
|
157
321
|
"source": [
|
@@ -162,25 +326,31 @@
|
|
162
326
|
" ylabel 'y label'\n",
|
163
327
|
" title 'scatter sample'\n",
|
164
328
|
"end\n",
|
165
|
-
"IRuby.display(IRuby.html(scatter.render))"
|
329
|
+
"IRuby.display(IRuby.html(scatter.render))\n",
|
330
|
+
"nil"
|
166
331
|
]
|
167
332
|
},
|
168
333
|
{
|
169
334
|
"cell_type": "code",
|
170
|
-
"execution_count":
|
335
|
+
"execution_count": 7,
|
171
336
|
"metadata": {},
|
172
337
|
"outputs": [
|
173
338
|
{
|
174
339
|
"data": {
|
175
340
|
"text/html": [
|
176
|
-
"
|
341
|
+
" \n",
|
177
342
|
" <script type=\"text/javascript\">\n",
|
178
343
|
" google.charts.load(\"current\", {packages:[\"corechart\"]});\n",
|
179
344
|
" google.charts.setOnLoadCallback(drawChart);\n",
|
180
345
|
" function drawChart() {\n",
|
181
|
-
" const data = google.visualization.
|
182
|
-
"
|
183
|
-
"
|
346
|
+
" const data = new google.visualization.DataTable();\n",
|
347
|
+
" data.addColumn('string', 'ID');\n",
|
348
|
+
" data.addColumn('number', 'X');\n",
|
349
|
+
" data.addColumn('number', 'Y');\n",
|
350
|
+
" data.addColumn('string', 'GROUP');\n",
|
351
|
+
" data.addColumn('number', 'SIZE');\n",
|
352
|
+
"\n",
|
353
|
+
" data.addRows([[\"\", 0, 0.0, \"sample1\", 10], [\"\", 1, 0.1, \"sample1\", 100], [\"\", 2, 0.2, \"sample1\", 1000], [\"\", 3, 0.30000000000000004, \"sample1\", 20], [\"\", 4, 0.4, \"sample1\", 200], [\"\", 5, 0.5, \"sample1\", 2000], [\"\", 6, 0.6000000000000001, \"sample1\", 5], [\"\", 7, 0.7000000000000001, \"sample1\", 50], [\"\", 8, 0.8, \"sample1\", 500], [\"\", 9, 0.9, \"sample1\", 4], [\"\", 10, 1.0, \"sample1\", 40], [\"\", 0, 0.0, \"sample2\", 1], [\"\", 1, 0.2, \"sample2\", 10], [\"\", 2, 0.4, \"sample2\", 100], [\"\", 3, 0.6000000000000001, \"sample2\", 1000], [\"\", 4, 0.8, \"sample2\", 500], [\"\", 5, 1.0, \"sample2\", 100], [\"\", 0, 0, \"2\", 40], [\"\", 1, -0.1, \"2\", 30], [\"\", 2, -0.5, \"2\", 200], [\"\", 3, -0.5, \"2\", 10], [\"\", 4, 0.1, \"2\", 5]])\n",
|
184
354
|
"\n",
|
185
355
|
" const view = new google.visualization.DataView(data);\n",
|
186
356
|
"\n",
|
@@ -202,28 +372,18 @@
|
|
202
372
|
" },\n",
|
203
373
|
" legend: { position: \"none\" },\n",
|
204
374
|
" };\n",
|
205
|
-
" const chart = new google.visualization.BubbleChart(document.getElementById(\"BubbleChart-
|
375
|
+
" const chart = new google.visualization.BubbleChart(document.getElementById(\"BubbleChart-6\"));\n",
|
206
376
|
" chart.draw(view, options);\n",
|
207
377
|
" }\n",
|
208
378
|
" </script>\n",
|
209
|
-
" <div id=\"BubbleChart-
|
379
|
+
" <div id=\"BubbleChart-6\" style=\"width: 900px; height: 300px;\"></div>\n"
|
210
380
|
],
|
211
381
|
"text/plain": [
|
212
|
-
"\"
|
382
|
+
"\" \\n <script type=\\\"text/javascript\\\">\\n google.charts.load(\\\"current\\\", {packages:[\\\"corechart\\\"]});\\n google.charts.setOnLoadCallback(drawChart);\\n function drawChart() {\\n const data = new google.visualization.DataTable();\\n data.addColumn('string', 'ID');\\n data.addColumn('number', 'X');\\n data.addColumn('number', 'Y');\\n data.addColumn('string', 'GROUP');\\n data.addColumn('number', 'SIZE');\\n\\n data.addRows([[\\\"\\\", 0, 0.0, \\\"sample1\\\", 10], [\\\"\\\", 1, 0.1, \\\"sample1\\\", 100], [\\\"\\\", 2, 0.2, \\\"sample1\\\", 1000], [\\\"\\\", 3, 0.30000000000000004, \\\"sample1\\\", 20], [\\\"\\\", 4, 0.4, \\\"sample1\\\", 200], [\\\"\\\", 5, 0.5, \\\"sample1\\\", 2000], [\\\"\\\", 6, 0.6000000000000001, \\\"sample1\\\", 5], [\\\"\\\", 7, 0.7000000000000001, \\\"sample1\\\", 50], [\\\"\\\", 8, 0.8, \\\"sample1\\\", 500], [\\\"\\\", 9, 0.9, \\\"sample1\\\", 4], [\\\"\\\", 10, 1.0, \\\"sample1\\\", 40], [\\\"\\\", 0, 0.0, \\\"sample2\\\", 1], [\\\"\\\", 1, 0.2, \\\"sample2\\\", 10], [\\\"\\\", 2, 0.4, \\\"sample2\\\", 100], [\\\"\\\", 3, 0.6000000000000001, \\\"sample2\\\", 1000], [\\\"\\\", 4, 0.8, \\\"sample2\\\", 500], [\\\"\\\", 5, 1.0, \\\"sample2\\\", 100], [\\\"\\\", 0, 0, \\\"2\\\", 40], [\\\"\\\", 1, -0.1, \\\"2\\\", 30], [\\\"\\\", 2, -0.5, \\\"2\\\", 200], [\\\"\\\", 3, -0.5, \\\"2\\\", 10], [\\\"\\\", 4, 0.1, \\\"2\\\", 5]])\\n\\n const view = new google.visualization.DataView(data);\\n\\n const options = {\\n title: \\\"bubble sample\\\",\\n vAxis: {\\n title: \\\"y label\\\",\\n viewWindow: {\\n max: 1,\\n min: -1,\\n },\\n },\\n hAxis: {\\n title: \\\"x label\\\",\\n viewWindow: {\\n max: 10,\\n min: 0,\\n }\\n },\\n legend: { position: \\\"none\\\" },\\n };\\n const chart = new google.visualization.BubbleChart(document.getElementById(\\\"BubbleChart-6\\\"));\\n chart.draw(view, options);\\n }\\n </script>\\n <div id=\\\"BubbleChart-6\\\" style=\\\"width: 900px; height: 300px;\\\"></div>\\n\""
|
213
383
|
]
|
214
384
|
},
|
215
385
|
"metadata": {},
|
216
386
|
"output_type": "display_data"
|
217
|
-
},
|
218
|
-
{
|
219
|
-
"data": {
|
220
|
-
"text/plain": [
|
221
|
-
"#<CZTop::Socket::PUB:0x7fc4430de3c0 last_endpoint=\"tcp://127.0.0.1:49318\">"
|
222
|
-
]
|
223
|
-
},
|
224
|
-
"execution_count": 4,
|
225
|
-
"metadata": {},
|
226
|
-
"output_type": "execute_result"
|
227
387
|
}
|
228
388
|
],
|
229
389
|
"source": [
|
@@ -236,7 +396,8 @@
|
|
236
396
|
" ylabel 'y label'\n",
|
237
397
|
" title 'bubble sample'\n",
|
238
398
|
"end\n",
|
239
|
-
"IRuby.display(IRuby.html(bubble.render))"
|
399
|
+
"IRuby.display(IRuby.html(bubble.render))\n",
|
400
|
+
"nil"
|
240
401
|
]
|
241
402
|
},
|
242
403
|
{
|
@@ -249,7 +410,7 @@
|
|
249
410
|
],
|
250
411
|
"metadata": {
|
251
412
|
"kernelspec": {
|
252
|
-
"display_name": "Ruby 2.
|
413
|
+
"display_name": "Ruby 2.6.2",
|
253
414
|
"language": "ruby",
|
254
415
|
"name": "ruby"
|
255
416
|
},
|
@@ -257,7 +418,7 @@
|
|
257
418
|
"file_extension": ".rb",
|
258
419
|
"mimetype": "application/x-ruby",
|
259
420
|
"name": "ruby",
|
260
|
-
"version": "2.
|
421
|
+
"version": "2.6.2"
|
261
422
|
}
|
262
423
|
},
|
263
424
|
"nbformat": 4,
|