gnutemplate 0.1.6 → 0.1.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfcba5163d0b3ee698d44dcedeb4bdbff59a78cc8d9664cffc9616382a78ccad
4
- data.tar.gz: adb0cd61d35455dc9f2f0ffa099d52c3555d128940754e48061e1a64129236f3
3
+ metadata.gz: c69189fd4dac115b797679a47830cbc77c3c66d593f611ee5192159d331f6bbb
4
+ data.tar.gz: 77dcfea02ef16af3f38d256802f3cdd583b81bb5cf14ad11f2dc07badf7edec6
5
5
  SHA512:
6
- metadata.gz: 812ddd1d2c4555ace77903223766260c81e2b933c223d3357fd698372e5c02d9a556e528e5afb659e62ef917403d1913209318e4c9d8db55623df79d49efc7d0
7
- data.tar.gz: 2b33faa3748583196db76754df4142bc26835dbd59e1ff7f1e9e90ccc192b73476bf6ceb132b661b40f8e3013de5fa7ab2b5c29b5ad3a7d6b7ead1dc595123ee
6
+ metadata.gz: 3ebcfa577e172cf2562a5111842ca926248fad462516b7fd6a1c7aaa847a7308b3c2f71fdfa05acf8c043cc55eea4808c04208b283cbfcc76e8fb464d7711733
7
+ data.tar.gz: 308aca33a72e7900c1195d088529f16a84d7fcd44edbc191a68977a5125ff266e0d3de51a5ad83290572b6d67db4f4f5945a9ac6bd55d71cdfd56dcb92dd6333
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gnutemplate
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.8"
5
5
  end
data/lib/gnutemplate.rb CHANGED
@@ -123,9 +123,9 @@ module Gnutemplate
123
123
  alpha_hex = (alpha * 256 / 100).to_s(16).upcase
124
124
  colors = ["##{alpha_hex}CC0000", "##{alpha_hex}00CC00", "##{alpha_hex}0000CC", "##{alpha_hex}888800"]
125
125
 
126
- xmax ||= data.map(&:to_a).flatten.max
127
- xmin ||= data.map(&:to_a).flatten.min
128
- freqs = data.map {|d| d.to_a.histogram(bins, min: xmin, max: xmax) }
126
+ xmax ||= data.map(&:to_a).flatten.compact.max
127
+ xmin ||= data.map(&:to_a).flatten.compact.min
128
+ freqs = data.map {|d| d.to_a.compact.histogram(bins, min: xmin, max: xmax) }
129
129
  ymax ||= freqs.map{ _1[1] }.flatten.max * 1.1
130
130
 
131
131
  Numo.noteplot do
@@ -186,9 +186,17 @@ module Gnutemplate
186
186
  .gsub(/,$/, ")")
187
187
  set xtics: xtics
188
188
 
189
- plot [*freqs[0], using: 2, w: :histogram, t: labels[0], fillcolor: "rgb \"#{colors[0 % 4]}\""],
190
- [*freqs[1], using: 2, w: :histogram, t: labels[1], fillcolor: "rgb \"#{colors[1 % 4]}\""],
191
- [*freqs[2], using: 2, w: :histogram, t: labels[2], fillcolor: "rgb \"#{colors[2 % 4]}\""]
189
+ labels ||= (0...(freqs.length)).map(&:to_s)
190
+
191
+ args = freqs.zip(labels).each_with_index.map do |(f, l), i|
192
+ [*f, using: 2, :histogram, t: labels[i], fillcolor: "rgb \"#{colors[0 % 4]}\""]
193
+ end
194
+
195
+ plot *args
196
+ #plot [*freqs[0], using: 2, w: :histogram, t: labels[0], fillcolor: "rgb \"#{colors[0 % 4]}\""],
197
+ #[*freqs[1], using: 2, w: :histogram, t: labels[1], fillcolor: "rgb \"#{colors[1 % 4]}\""],
198
+ #[*freqs[2], using: 2, w: :histogram, t: labels[2], fillcolor: "rgb \"#{colors[2 % 4]}\""]
199
+
192
200
  end # Of if pileup..else
193
201
  end # Of Numo.noteplot do
194
202
 
@@ -205,9 +213,9 @@ module Gnutemplate
205
213
  alpha_hex = (alpha * 256 / 100).to_s(16).upcase
206
214
  colors = ["##{alpha_hex}CC0000", "##{alpha_hex}00CC00", "##{alpha_hex}0000CC", "##{alpha_hex}888800"]
207
215
 
208
- xmax ||= data.map(&:to_a).flatten.max
209
- xmin ||= data.map(&:to_a).flatten.min
210
- freqs = data.map {|d| d.to_a.histogram(bins, min: xmin, max: xmax) }
216
+ xmax ||= data.map(&:to_a).flatten.compact.max
217
+ xmin ||= data.map(&:to_a).flatten.compact.min
218
+ freqs = data.map {|d| d.to_a.compact.histogram(bins, min: xmin, max: xmax) }
211
219
  ymax ||= freqs.map{ _1[1] }.flatten.max * 1.1
212
220
 
213
221
  Numo.gnuplot do
@@ -267,9 +275,18 @@ module Gnutemplate
267
275
  .gsub(/,$/, ")")
268
276
  set xtics: xtics
269
277
 
270
- plot [*freqs[0], using: 2, w: :histogram, t: labels[0], fillcolor: "rgb \"#{colors[0 % 4]}\""],
271
- [*freqs[1], using: 2, w: :histogram, t: labels[1], fillcolor: "rgb \"#{colors[1 % 4]}\""],
272
- [*freqs[2], using: 2, w: :histogram, t: labels[2], fillcolor: "rgb \"#{colors[2 % 4]}\""]
278
+ labels ||= (0...(freqs.length)).map(&:to_s)
279
+
280
+ args = freqs.zip(labels).each_with_index.map do |(f, l), i|
281
+ [*f, using: 2, :histogram, t: labels[i], fillcolor: "rgb \"#{colors[0 % 4]}\""]
282
+ end
283
+
284
+ plot *args
285
+
286
+ #plot [*freqs[0], using: 2, w: :histogram, t: labels[0], fillcolor: "rgb \"#{colors[0 % 4]}\""],
287
+ #[*freqs[1], using: 2, w: :histogram, t: labels[1], fillcolor: "rgb \"#{colors[1 % 4]}\""],
288
+ #[*freqs[2], using: 2, w: :histogram, t: labels[2], fillcolor: "rgb \"#{colors[2 % 4]}\""]
289
+
273
290
  end # Of if pileup..else
274
291
  end # Of Numo.noteplot do
275
292
 
data/todo.txt ADDED
@@ -0,0 +1,18 @@
1
+ nilあり対応
2
+
3
+ 散布図
4
+ 縦棒 積み上げ縦棒 100%積み上げ縦棒
5
+ パレート図
6
+ ave, max, min, sigma図
7
+ マッピング
8
+ contour + プロット
9
+ 縦書き横並びヒスト(JSCが使ってたやつ)
10
+ + demoにあるものでめぼしいものを
11
+
12
+ ※ note, plot 統一 => むずい
13
+
14
+ ・汎用的な重ね方 => クラス化するしかないと思う
15
+           現在の表記も残す
16
+ ・サブプロット 簡易的にするため、同種だけ並べられるようにする。
17
+
18
+ 色 自由指定+ パレット増やす
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnutemplate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - showata
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-09 00:00:00.000000000 Z
11
+ date: 2023-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: numo-gnuplot
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: Templates of boxplot, histgram, etc.
41
+ description: Templates of boxplot, histogram, etc.
42
42
  email:
43
43
  - shun_yamaguchi_tc@live.jp
44
44
  executables: []
@@ -54,6 +54,7 @@ files:
54
54
  - lib/gnutemplate.rb
55
55
  - lib/gnutemplate/version.rb
56
56
  - sig/gnutemplate.rbs
57
+ - todo.txt
57
58
  homepage: https://github.com/show-o-atakun/gnutemplate
58
59
  licenses:
59
60
  - MIT