unicode_plot 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/README.md +10 -12
- data/Rakefile +4 -1
- data/lib/unicode_plot.rb +3 -5
- data/lib/unicode_plot/barplot.rb +67 -2
- data/lib/unicode_plot/canvas.rb +18 -9
- data/lib/unicode_plot/{ascii_canvas.rb → canvas/ascii_canvas.rb} +4 -0
- data/lib/unicode_plot/canvas/block_canvas.rb +38 -0
- data/lib/unicode_plot/{braille_canvas.rb → canvas/braille_canvas.rb} +3 -1
- data/lib/unicode_plot/{density_canvas.rb → canvas/density_canvas.rb} +2 -0
- data/lib/unicode_plot/{dot_canvas.rb → canvas/dot_canvas.rb} +2 -0
- data/lib/unicode_plot/{lookup_canvas.rb → canvas/lookup_canvas.rb} +1 -1
- data/lib/unicode_plot/io_context.rb +32 -0
- data/lib/unicode_plot/lineplot.rb +36 -0
- data/lib/unicode_plot/plot.rb +8 -3
- data/lib/unicode_plot/renderer.rb +5 -1
- data/lib/unicode_plot/stairs.rb +88 -0
- data/lib/unicode_plot/stemplot.rb +344 -0
- data/lib/unicode_plot/styled_printer.rb +1 -5
- data/lib/unicode_plot/version.rb +1 -1
- data/test/helper/with_term.rb +16 -10
- data/test/test-barplot.rb +8 -0
- data/test/test-boxplot.rb +8 -0
- data/test/test-canvas.rb +15 -8
- data/test/test-densityplot.rb +8 -0
- data/test/test-histogram.rb +8 -0
- data/test/test-lineplot.rb +85 -1
- data/test/test-plot.rb +16 -0
- data/test/test-scatterplot.rb +8 -0
- data/test/test-stemplot.rb +95 -0
- data/test/test-utils.rb +13 -0
- data/unicode_plot.gemspec +4 -0
- metadata +40 -20
- data/lib/unicode_plot/layout.rb +0 -51
- data/test/test-result.rb +0 -0
data/unicode_plot.gemspec
CHANGED
@@ -19,6 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.homepage = "https://github.com/red-data-tools/unicode_plot.rb"
|
20
20
|
spec.license = "MIT"
|
21
21
|
|
22
|
+
spec.metadata ||= {}
|
23
|
+
spec.metadata["documentation_uri"] = "https://red-data-tools.github.io/unicode_plot.rb/#{spec.version}/"
|
24
|
+
|
22
25
|
spec.files = ["README.md", "Rakefile", "Gemfile", "#{spec.name}.gemspec"]
|
23
26
|
spec.files << "LICENSE.txt"
|
24
27
|
spec.files.concat Dir.glob("lib/**/*.rb")
|
@@ -34,4 +37,5 @@ Gem::Specification.new do |spec|
|
|
34
37
|
spec.add_development_dependency "bundler", ">= 1.17"
|
35
38
|
spec.add_development_dependency "rake"
|
36
39
|
spec.add_development_dependency "test-unit"
|
40
|
+
spec.add_development_dependency "yard"
|
37
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode_plot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mrkn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: enumerable-statistics
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Plot your data by Unicode characters
|
70
84
|
email:
|
71
85
|
- mrkn@mrkn.jp
|
@@ -78,22 +92,25 @@ files:
|
|
78
92
|
- README.md
|
79
93
|
- Rakefile
|
80
94
|
- lib/unicode_plot.rb
|
81
|
-
- lib/unicode_plot/ascii_canvas.rb
|
82
95
|
- lib/unicode_plot/barplot.rb
|
83
96
|
- lib/unicode_plot/boxplot.rb
|
84
|
-
- lib/unicode_plot/braille_canvas.rb
|
85
97
|
- lib/unicode_plot/canvas.rb
|
86
|
-
- lib/unicode_plot/
|
98
|
+
- lib/unicode_plot/canvas/ascii_canvas.rb
|
99
|
+
- lib/unicode_plot/canvas/block_canvas.rb
|
100
|
+
- lib/unicode_plot/canvas/braille_canvas.rb
|
101
|
+
- lib/unicode_plot/canvas/density_canvas.rb
|
102
|
+
- lib/unicode_plot/canvas/dot_canvas.rb
|
103
|
+
- lib/unicode_plot/canvas/lookup_canvas.rb
|
87
104
|
- lib/unicode_plot/densityplot.rb
|
88
|
-
- lib/unicode_plot/dot_canvas.rb
|
89
105
|
- lib/unicode_plot/grid_plot.rb
|
90
106
|
- lib/unicode_plot/histogram.rb
|
91
|
-
- lib/unicode_plot/
|
107
|
+
- lib/unicode_plot/io_context.rb
|
92
108
|
- lib/unicode_plot/lineplot.rb
|
93
|
-
- lib/unicode_plot/lookup_canvas.rb
|
94
109
|
- lib/unicode_plot/plot.rb
|
95
110
|
- lib/unicode_plot/renderer.rb
|
96
111
|
- lib/unicode_plot/scatterplot.rb
|
112
|
+
- lib/unicode_plot/stairs.rb
|
113
|
+
- lib/unicode_plot/stemplot.rb
|
97
114
|
- lib/unicode_plot/styled_printer.rb
|
98
115
|
- lib/unicode_plot/utils.rb
|
99
116
|
- lib/unicode_plot/value_transformer.rb
|
@@ -109,13 +126,15 @@ files:
|
|
109
126
|
- test/test-histogram.rb
|
110
127
|
- test/test-lineplot.rb
|
111
128
|
- test/test-plot.rb
|
112
|
-
- test/test-result.rb
|
113
129
|
- test/test-scatterplot.rb
|
130
|
+
- test/test-stemplot.rb
|
131
|
+
- test/test-utils.rb
|
114
132
|
- unicode_plot.gemspec
|
115
133
|
homepage: https://github.com/red-data-tools/unicode_plot.rb
|
116
134
|
licenses:
|
117
135
|
- MIT
|
118
|
-
metadata:
|
136
|
+
metadata:
|
137
|
+
documentation_uri: https://red-data-tools.github.io/unicode_plot.rb/0.0.5/
|
119
138
|
post_install_message:
|
120
139
|
rdoc_options: []
|
121
140
|
require_paths:
|
@@ -131,21 +150,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
150
|
- !ruby/object:Gem::Version
|
132
151
|
version: '0'
|
133
152
|
requirements: []
|
134
|
-
rubygems_version: 3.
|
153
|
+
rubygems_version: 3.2.3
|
135
154
|
signing_key:
|
136
155
|
specification_version: 4
|
137
156
|
summary: Plot your data by Unicode characters
|
138
157
|
test_files:
|
139
|
-
- test/
|
158
|
+
- test/helper/fixture.rb
|
159
|
+
- test/helper/with_term.rb
|
160
|
+
- test/helper.rb
|
140
161
|
- test/run-test.rb
|
141
162
|
- test/test-barplot.rb
|
142
|
-
- test/
|
143
|
-
- test/test-lineplot.rb
|
144
|
-
- test/test-densityplot.rb
|
145
|
-
- test/test-plot.rb
|
163
|
+
- test/test-boxplot.rb
|
146
164
|
- test/test-canvas.rb
|
147
|
-
- test/test-
|
165
|
+
- test/test-densityplot.rb
|
148
166
|
- test/test-histogram.rb
|
149
|
-
- test/
|
150
|
-
- test/
|
151
|
-
- test/test-
|
167
|
+
- test/test-lineplot.rb
|
168
|
+
- test/test-plot.rb
|
169
|
+
- test/test-scatterplot.rb
|
170
|
+
- test/test-stemplot.rb
|
171
|
+
- test/test-utils.rb
|
data/lib/unicode_plot/layout.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
module UnicodePlot
|
2
|
-
class GridLayout
|
3
|
-
DEFAULT_WIDTH = 80
|
4
|
-
|
5
|
-
def initialize(n_rows, n_columns, width: Layout::DEFAULT_WIDTH)
|
6
|
-
@n_rows = n_rows
|
7
|
-
@n_columns = n_columns
|
8
|
-
@width = width
|
9
|
-
end
|
10
|
-
|
11
|
-
def [](i, j)
|
12
|
-
@plots[i * n_cols + j]
|
13
|
-
end
|
14
|
-
|
15
|
-
def []=(i, j, plot)
|
16
|
-
@plots[i * n_cols + j] = plot
|
17
|
-
end
|
18
|
-
|
19
|
-
def <<(plot)
|
20
|
-
@plots << plot
|
21
|
-
end
|
22
|
-
|
23
|
-
def render(out)
|
24
|
-
buffers = []
|
25
|
-
(0 ... n_rows).each do |i|
|
26
|
-
(0 ... n_columns).each do |j|
|
27
|
-
StringIO.open do |sio|
|
28
|
-
def sio.tty?; true; end
|
29
|
-
render_cell(sio, i, j)
|
30
|
-
sio.close
|
31
|
-
buffers << sio.string
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def render_cell(out, i, j)
|
38
|
-
plot = self[i, j]
|
39
|
-
return unless plot
|
40
|
-
plot.width = cell_width
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
module_function def grid_layout(n_rows, n_cols, *plots, **kw)
|
45
|
-
grid = GridLayout.new(n_rows, n_cols, **kw)
|
46
|
-
plots.each do |plot|
|
47
|
-
grid << plot
|
48
|
-
end
|
49
|
-
grid
|
50
|
-
end
|
51
|
-
end
|
data/test/test-result.rb
DELETED
File without changes
|