gnutemplate 0.2.0.3 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gnutemplate/version.rb +1 -1
- data/lib/gnutemplate.rb +244 -226
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93290973c56c3ad666081942d0a617d9274b6771d00df1beef5350c7933c43c2
|
4
|
+
data.tar.gz: 6568f2b90707a89e79614ced5814f80394128f90f8bd26009e216868569b7724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f7ff008cf98856a65a81dd3263ca8757962dcdaa4ea96a73e1f694c9084454f54d0789eaa97d1c95880a87d88a889e79adebcee9b51aa29ec9e87c95e4ff87b
|
7
|
+
data.tar.gz: 0b23cd08d1650299c548fef6db758cfcac3d776a7fede27fa3c298e815874b1bbfde67c498ddc2ed0172a9859ed3a6d4720d0a1ded55baab6477fb5bdd666ce5
|
data/lib/gnutemplate/version.rb
CHANGED
data/lib/gnutemplate.rb
CHANGED
@@ -31,6 +31,24 @@ end
|
|
31
31
|
module Gnutemplate
|
32
32
|
class Error < StandardError; end
|
33
33
|
|
34
|
+
|
35
|
+
# settingはむずい
|
36
|
+
# ・全体はハッシュ
|
37
|
+
# ・基本は次のような指定
|
38
|
+
# settings[:style] = "fill solid"
|
39
|
+
# ・ハッシュを使う場合も。以下は、set :xtic, :rotate, by: rotate_xtics, scale: 0の表現怜
|
40
|
+
# settings[:xtic] = {rotate: nil, by: rotate_xtics, scale: 0}
|
41
|
+
# ・同じキー(例えばxtics)に複数指定たいときはリストにして渡す
|
42
|
+
# settings[:xtics] = ["#{xmin-xticinterval}, #{xticinterval}, #{xmax+xticinterval}" ,
|
43
|
+
# "rotate by #{rotate_xtics}"]
|
44
|
+
# ・リストの中を更にハッシュにすることも可能
|
45
|
+
# settings[:style] = [{data: nil, histogram: nil}, # set :style, :data, :histogram を表現
|
46
|
+
# {histogram: nil, cluster: nil, gap: 1}, # set :histogram, :cluster, gap: 1 を表現
|
47
|
+
# {fill: nil, solid: 1.0 - (alpha/100.0), border: -1}]
|
48
|
+
|
49
|
+
|
50
|
+
SubPlot = Struct.new(:args, :settings)
|
51
|
+
|
34
52
|
def note_line(data)
|
35
53
|
Numo.noteplot do
|
36
54
|
set xtics: xtics
|
@@ -51,6 +69,10 @@ module Gnutemplate
|
|
51
69
|
end
|
52
70
|
end
|
53
71
|
|
72
|
+
def box(rows, titlenames, xrange: nil, xtics: nil, title: nil, file: nil, alpha: 60)
|
73
|
+
|
74
|
+
end
|
75
|
+
|
54
76
|
# 一つのデータで min, max 2列必要とするので
|
55
77
|
# rows = [minデータ1, maxデータ1, minデータ2, maxデータ2, ...] という形式で入れてやる
|
56
78
|
# xrangeはx軸の範囲(数値..数値の範囲で指定)で、xticsは実際に目盛に表示するラベル(Stringなどの配列)
|
@@ -104,42 +126,40 @@ module Gnutemplate
|
|
104
126
|
# 列データをmin, maxごとに分離する
|
105
127
|
rows_min = (0...(rows.length)).to_a.map {|i| rows[i] if i % 2 == 0}.compact
|
106
128
|
rows_max = (0...(rows.length)).to_a.map {|i| rows[i] if i % 2 == 1}.compact
|
107
|
-
|
108
|
-
Numo.gnuplot do
|
109
|
-
if !file.nil?
|
110
|
-
set terminal: "gif"
|
111
|
-
set output: file
|
112
|
-
end
|
113
129
|
|
114
|
-
|
115
|
-
|
116
|
-
set :xtics, "rotate by 90"
|
117
|
-
end
|
118
|
-
|
119
|
-
xrange ||= (rows_min.map(&:to_a).flatten.compact.min)..(rows_max.map(&:to_a).flatten.compact.max)
|
120
|
-
set xrange: xrange
|
121
|
-
set :grid
|
122
|
-
set style: :fill_solid
|
123
|
-
set title: title if title
|
124
|
-
|
125
|
-
### キャンドルスティックを応用する
|
126
|
-
# X軸, 太い所の最大値, 最大値, 最小値, 太い所の最小値
|
127
|
-
# 今回は細い箇所は不要
|
128
|
-
# X軸はこの場合配列にしなきゃだめ(to_a) これは癖をつけたほうが安全
|
130
|
+
settings = {}
|
131
|
+
args = []
|
129
132
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
+
if !xtics.nil?
|
134
|
+
set[:xtics] = [xtics]
|
135
|
+
set[:xtics].push "rotate by 90"
|
136
|
+
end
|
133
137
|
|
134
|
-
|
138
|
+
xrange ||= (rows_min.map(&:to_a).flatten.compact.min)..(rows_max.map(&:to_a).flatten.compact.max)
|
139
|
+
|
140
|
+
set[:xrange] = xrange
|
141
|
+
set[:grid] = nil
|
142
|
+
set[:style] = :fill_solid
|
143
|
+
set[:title] = title if title
|
144
|
+
|
145
|
+
### キャンドルスティックを応用する
|
146
|
+
# X軸, 太い所の最大値, 最大値, 最小値, 太い所の最小値
|
147
|
+
# 今回は細い箇所は不要
|
148
|
+
# X軸はこの場合配列にしなきゃだめ(to_a) これは癖をつけたほうが安全
|
149
|
+
|
150
|
+
args = rows_min.zip(rows_max, titlenames).each.with_index.inject([]) do |result, ((mi, ma, t), i)|
|
151
|
+
result += [xrange.to_a, mi.to_a, mi.to_a, ma.to_a, ma.to_a, {with: "candlesticks", fc_rgb: colors[i % 4], title: t} ]
|
135
152
|
end
|
153
|
+
|
154
|
+
plot *args
|
155
|
+
|
136
156
|
end
|
137
157
|
|
138
|
-
#
|
158
|
+
# ここからsettings, argsを返せるようにする
|
139
159
|
# set terminal部の扱いは考えなければならない(多分、_drow, _noteにif...set...end だけ残せばいい)
|
140
160
|
def histogram(data, labels: nil, pileup: true,
|
141
161
|
xmin: nil, xmax: nil, ymin: 0, ymax: nil, bins: 10,
|
142
|
-
|
162
|
+
plotsize: nil, rotate_xtics: 45,
|
143
163
|
fill: true, alpha: 33, background: nil,
|
144
164
|
file: nil)
|
145
165
|
|
@@ -154,21 +174,24 @@ module Gnutemplate
|
|
154
174
|
ymax ||= freqs.map{ _1[1] }.flatten.max * 1.1
|
155
175
|
|
156
176
|
if pileup
|
157
|
-
###########
|
158
|
-
###
|
159
|
-
###########
|
160
|
-
|
161
|
-
set size: "#{figsize},#{figsize}"
|
162
|
-
set style: "fill solid" if fill
|
163
177
|
|
164
178
|
xticinterval = (xmax-xmin).to_f / bins
|
165
|
-
set xtics: "#{xmin-xticinterval}, #{xticinterval}, #{xmax+xticinterval}"
|
166
|
-
set(:xtics, "rotate by #{rotate_xtics}") if rotate_xtics
|
167
179
|
|
168
|
-
|
169
|
-
|
180
|
+
settings = {}
|
181
|
+
settings[:size] = "#{plotsize[0]},#{plotsize[1]}" if plotsize
|
182
|
+
settings[:style] = "fill solid" if fill
|
183
|
+
|
184
|
+
settings[:xtics] = ["#{xmin-xticinterval}, #{xticinterval}, #{xmax+xticinterval}"]
|
185
|
+
settings[:xtics].push("rotate by #{rotate_xtics}") if rotate_xtics
|
170
186
|
|
171
|
-
|
187
|
+
settings[:xrange] = (xmin-xticinterval)..(xmax+xticinterval)
|
188
|
+
settings[:yrange] = ymin..ymax
|
189
|
+
|
190
|
+
args = if background
|
191
|
+
["[#{xmin}:#{xmax}] #{ymax} with filledc above y=#{ymin} fc \"##{background}\" notitle", {}]
|
192
|
+
else
|
193
|
+
[]
|
194
|
+
end
|
172
195
|
|
173
196
|
freqs.each_with_index do |f, i|
|
174
197
|
args.push f[0], f[1]
|
@@ -180,29 +203,27 @@ module Gnutemplate
|
|
180
203
|
end
|
181
204
|
end
|
182
205
|
|
183
|
-
return args
|
206
|
+
return SubPlot.new(args, settings)
|
184
207
|
|
185
208
|
else
|
186
209
|
|
187
|
-
###########
|
188
|
-
###
|
189
|
-
###########
|
190
210
|
# set title:"Temperature"
|
191
|
-
|
192
|
-
|
193
|
-
set :style, :
|
194
|
-
|
195
|
-
|
196
|
-
|
211
|
+
settings = {}
|
212
|
+
settings[:auto] = "x"
|
213
|
+
settings[:style] = [{data: nil, histogram: nil}, # set :style, :data, :histogram を表現
|
214
|
+
{histogram: nil, cluster: nil, gap: 1}, # set :histogram, :cluster, gap: 1 を表現
|
215
|
+
{fill: nil, solid: 1.0 - (alpha/100.0), border: -1}]
|
216
|
+
settings[:boxwidth] = 0.9
|
217
|
+
settings[:xtic] = {rotate: nil, by: rotate_xtics, scale: 0}
|
197
218
|
|
198
219
|
xticinterval = (xmax-xmin).to_f / bins
|
199
|
-
|
220
|
+
settings[:xrange] = 0..((xmax-xmin) / xticinterval).to_i
|
200
221
|
|
201
222
|
xtics = freqs[0][0]
|
202
223
|
.each.with_index
|
203
224
|
.inject("(") { |result, (x, i)| result += "'#{x-xticinterval/2}-#{x+xticinterval/2}' #{i}," }
|
204
225
|
.gsub(/,$/, ")")
|
205
|
-
|
226
|
+
settings[:xtics] = xtics
|
206
227
|
|
207
228
|
labels ||= (0...(freqs.length)).map(&:to_s)
|
208
229
|
|
@@ -210,200 +231,197 @@ module Gnutemplate
|
|
210
231
|
[*f, using: 2, w: :histogram, t: labels[i], fillcolor: "rgb \"#{colors[i % 4]}\""]
|
211
232
|
end
|
212
233
|
|
213
|
-
return args
|
234
|
+
return SubPlot.new(args, settings)
|
214
235
|
|
215
236
|
end # Of if pileup..else
|
216
237
|
end
|
217
|
-
module_function :histogram
|
218
238
|
|
219
239
|
def note_histogram(data, labels: nil, pileup: true,
|
220
240
|
xmin: nil, xmax: nil, ymin: 0, ymax: nil, bins: 10,
|
221
|
-
|
241
|
+
plotsize: nil, rotate_xtics: 45,
|
222
242
|
fill: true, alpha: 33, background: nil,
|
223
243
|
file: nil)
|
224
244
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
args = Gnutemplate.histogram(data, labels: labels, pileup: pileup,
|
233
|
-
xmin: xmin, xmax: xmax, ymin: ymin, ymax: ymax, bins: bins,
|
234
|
-
figsize: figsize, rotate_xtics: rotate_xtics,
|
235
|
-
fill: fill, alpha: alpha, background: background)
|
236
|
-
|
237
|
-
plot *args
|
238
|
-
|
239
|
-
# data = [data] if data[0].kind_of?(Numeric) || data[0].nil?
|
240
|
-
|
241
|
-
# alpha_hex = (alpha * 256 / 100).to_s(16).upcase
|
242
|
-
# colors = ["##{alpha_hex}CC0000", "##{alpha_hex}00CC00", "##{alpha_hex}0000CC", "##{alpha_hex}888800"]
|
243
|
-
|
244
|
-
# xmax ||= data.map(&:to_a).flatten.compact.max
|
245
|
-
# xmin ||= data.map(&:to_a).flatten.compact.min
|
246
|
-
# freqs = data.map {|d| d.to_a.compact.histogram(bins, min: xmin, max: xmax) }
|
247
|
-
# ymax ||= freqs.map{ _1[1] }.flatten.max * 1.1
|
248
|
-
|
249
|
-
|
250
|
-
# if pileup
|
251
|
-
# ###########
|
252
|
-
# ###
|
253
|
-
# ###########
|
254
|
-
|
255
|
-
# set size: "#{figsize},#{figsize}"
|
256
|
-
# set style: "fill solid" if fill
|
257
|
-
|
258
|
-
# xticinterval = (xmax-xmin).to_f / bins
|
259
|
-
# set xtics: "#{xmin-xticinterval}, #{xticinterval}, #{xmax+xticinterval}"
|
260
|
-
# set(:xtics, "rotate by #{rotate_xtics}") if rotate_xtics
|
261
|
-
|
262
|
-
# set xrange: (xmin-xticinterval)..(xmax+xticinterval)
|
263
|
-
# set yrange: ymin..ymax
|
264
|
-
|
265
|
-
# args = background ? ["[#{xmin}:#{xmax}] #{ymax} with filledc above y=#{ymin} fc \"##{background}\" notitle", {}] : []
|
266
|
-
|
267
|
-
# freqs.each_with_index do |f, i|
|
268
|
-
# args.push f[0], f[1]
|
269
|
-
|
270
|
-
# if labels
|
271
|
-
# args.push({:with => :boxes, :title => labels[i], :fillcolor => "rgb \"#{colors[i % 4]}\""})
|
272
|
-
# else
|
273
|
-
# args.push({:with => :boxes, :fillcolor => "rgb \"#{colors[i % 4]}\""})
|
274
|
-
# end
|
275
|
-
# end
|
276
|
-
|
277
|
-
# plot *args
|
278
|
-
|
279
|
-
# else
|
280
|
-
|
281
|
-
# ###########
|
282
|
-
# ###
|
283
|
-
# ###########
|
284
|
-
# # set title:"Temperature"
|
285
|
-
# set auto:"x"
|
286
|
-
# set :style, :data, :histogram
|
287
|
-
# set :style, :histogram, :cluster, gap:1
|
288
|
-
# set :style, :fill, solid: 1.0 - (alpha/100.0), border:-1
|
289
|
-
# set boxwidth:0.9
|
290
|
-
# set :xtic, :rotate, by: rotate_xtics, scale: 0
|
291
|
-
|
292
|
-
# xticinterval = (xmax-xmin).to_f / bins
|
293
|
-
# set xrange: 0..((xmax-xmin) / xticinterval).to_i
|
294
|
-
|
295
|
-
# xtics = freqs[0][0]
|
296
|
-
# .each.with_index
|
297
|
-
# .inject("(") { |result, (x, i)| result += "'#{x-xticinterval/2}-#{x+xticinterval/2}' #{i}," }
|
298
|
-
# .gsub(/,$/, ")")
|
299
|
-
# set xtics: xtics
|
300
|
-
|
301
|
-
# labels ||= (0...(freqs.length)).map(&:to_s)
|
302
|
-
|
303
|
-
# args = freqs.zip(labels).each_with_index.map do |(f, l), i|
|
304
|
-
# [*f, using: 2, w: :histogram, t: labels[i], fillcolor: "rgb \"#{colors[i % 4]}\""]
|
305
|
-
# end
|
306
|
-
|
307
|
-
# plot *args
|
308
|
-
|
309
|
-
# end # Of if pileup..else
|
310
|
-
|
311
|
-
end # Of Numo.noteplot do
|
312
|
-
|
245
|
+
as = Gnutemplate.histogram(data, labels: labels, pileup: pileup,
|
246
|
+
xmin: xmin, xmax: xmax, ymin: ymin, ymax: ymax, bins: bins,
|
247
|
+
plotsize: plotsize, rotate_xtics: rotate_xtics,
|
248
|
+
fill: fill, alpha: alpha, background: background)
|
249
|
+
|
250
|
+
note as, file: file
|
251
|
+
|
313
252
|
end # Of def function
|
314
253
|
|
315
254
|
def draw_histogram(data, labels: nil, pileup: true,
|
316
255
|
xmin: nil, xmax: nil, ymin: 0, ymax: nil, bins: 10,
|
317
|
-
|
256
|
+
plotsize: nil, rotate_xtics: 45,
|
318
257
|
fill: true, alpha: 33, background: nil,
|
319
258
|
file: nil)
|
320
259
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
args = Gnutemplate.histogram(data, labels: labels, pileup: pileup,
|
329
|
-
xmin: xmin, xmax: xmax, ymin: ymin, ymax: ymax, bins: bins,
|
330
|
-
figsize: figsize, rotate_xtics: rotate_xtics,
|
331
|
-
fill: fill, alpha: alpha, background: background)
|
332
|
-
|
333
|
-
plot *args
|
334
|
-
|
335
|
-
# data = [data] if data[0].kind_of?(Numeric) || data[0].nil?
|
260
|
+
as = Gnutemplate.histogram(data, labels: labels, pileup: pileup,
|
261
|
+
xmin: xmin, xmax: xmax, ymin: ymin, ymax: ymax, bins: bins,
|
262
|
+
plotsize: plotsize, rotate_xtics: rotate_xtics,
|
263
|
+
fill: fill, alpha: alpha, background: background)
|
264
|
+
|
265
|
+
draw as, file: file
|
336
266
|
|
337
|
-
|
338
|
-
# colors = ["##{alpha_hex}CC0000", "##{alpha_hex}00CC00", "##{alpha_hex}0000CC", "##{alpha_hex}888800"]
|
267
|
+
end # Of def function
|
339
268
|
|
340
|
-
# xmax ||= data.map(&:to_a).flatten.compact.max
|
341
|
-
# xmin ||= data.map(&:to_a).flatten.compact.min
|
342
|
-
# freqs = data.map {|d| d.to_a.compact.histogram(bins, min: xmin, max: xmax) }
|
343
|
-
# ymax ||= freqs.map{ _1[1] }.flatten.max * 1.1
|
344
|
-
|
345
|
-
# if pileup
|
346
|
-
# ###########
|
347
|
-
# ###
|
348
|
-
# ###########
|
349
|
-
|
350
|
-
# set size: "#{figsize},#{figsize}"
|
351
|
-
# set style: "fill solid" if fill
|
352
|
-
|
353
|
-
# xticinterval = (xmax-xmin).to_f / bins
|
354
|
-
# set xtics: "#{xmin-xticinterval}, #{xticinterval}, #{xmax+xticinterval}"
|
355
|
-
# set(:xtics, "rotate by #{rotate_xtics}") if rotate_xtics
|
356
|
-
|
357
|
-
# set xrange: (xmin-xticinterval)..(xmax+xticinterval)
|
358
|
-
# set yrange: ymin..ymax
|
359
|
-
|
360
|
-
# args = background ? ["[#{xmin}:#{xmax}] #{ymax} with filledc above y=#{ymin} fc \"##{background}\" notitle", {}] : []
|
361
269
|
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
270
|
+
def note(subplot, file: nil, campus_size: nil, multicolumn: 1) # for any plot function
|
271
|
+
|
272
|
+
subplot = [subplot] if !subplot.is_a?(Array)
|
273
|
+
|
274
|
+
Numo.noteplot do
|
275
|
+
|
276
|
+
if file
|
277
|
+
if campus_size
|
278
|
+
set termnal: "png", size: campus_size
|
279
|
+
else
|
280
|
+
set terminal: "png"
|
281
|
+
end
|
282
|
+
set output: file
|
283
|
+
end
|
284
|
+
|
285
|
+
# マルチプロット調整
|
286
|
+
multiline = (subplot.length.to_f / multicolumn).ceil
|
287
|
+
set :multiplot, layout: "#{multiline},#{multicolumn}"
|
288
|
+
|
289
|
+
# subplot一つ一つを描画
|
290
|
+
subplot.each do |sp|
|
291
|
+
|
292
|
+
# こういうのがパターンマッチでできるの?
|
293
|
+
sp.settings.each do |k, v|
|
294
|
+
if v.kind_of?(Hash)
|
295
|
+
sargs = []
|
296
|
+
skwargs = {}
|
297
|
+
|
298
|
+
v.map do |vk, vv|
|
299
|
+
if vv.nil?
|
300
|
+
sargs.push vk
|
301
|
+
else
|
302
|
+
skwargs[vk] = vv
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
set k, *sargs, **skwargs
|
307
|
+
|
308
|
+
elsif v.kind_of?(Array)
|
309
|
+
|
310
|
+
v.each do |vi|
|
311
|
+
if vi.kind_of?(Hash)
|
312
|
+
sargs = []
|
313
|
+
skwargs = {}
|
314
|
+
vi.map do |vk, vv|
|
315
|
+
if vv.nil?
|
316
|
+
sargs.push vk
|
317
|
+
else
|
318
|
+
skwargs[vk] = vv
|
319
|
+
end
|
320
|
+
end
|
321
|
+
set k, *sargs, **skwargs
|
322
|
+
else
|
323
|
+
set k, vi
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
else
|
328
|
+
|
329
|
+
if v.nil?
|
330
|
+
set k
|
331
|
+
else
|
332
|
+
set k, v
|
333
|
+
end
|
334
|
+
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
plot *(sp.args)
|
339
|
+
end # of subplot.each
|
340
|
+
|
341
|
+
unset :multiplot
|
342
|
+
|
343
|
+
end # of Numo.noteplot
|
344
|
+
end # of def draw
|
345
|
+
|
346
|
+
def draw(subplot, file: nil, campus_size: nil, multicolumn: 1) # for any plot function
|
347
|
+
|
348
|
+
subplot = [subplot] if !subplot.is_a?(Array)
|
349
|
+
|
350
|
+
Numo.gnuplot do
|
351
|
+
|
352
|
+
if file
|
353
|
+
if campus_size
|
354
|
+
set termnal: "png", size: campus_size
|
355
|
+
else
|
356
|
+
set terminal: "png"
|
357
|
+
end
|
358
|
+
set output: file
|
359
|
+
end
|
360
|
+
|
361
|
+
multiline = (subplot.length.to_f / multicolumn).ceil
|
362
|
+
set :multiplot, layout: "#{multiline},#{multicolumn}"
|
363
|
+
|
364
|
+
subplot.each do |sp|
|
365
|
+
|
366
|
+
# こういうのがパターンマッチでできるの?
|
367
|
+
sp.settings.each do |k, v|
|
368
|
+
if v.kind_of?(Hash)
|
369
|
+
sargs = []
|
370
|
+
skwargs = {}
|
371
|
+
|
372
|
+
v.map do |vk, vv|
|
373
|
+
if vv.nil?
|
374
|
+
sargs.push vk
|
375
|
+
else
|
376
|
+
skwargs[vk] = vv
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
set k, *sargs, **skwargs
|
381
|
+
|
382
|
+
elsif v.kind_of?(Array)
|
383
|
+
|
384
|
+
v.each do |vi|
|
385
|
+
if vi.kind_of?(Hash)
|
386
|
+
sargs = []
|
387
|
+
skwargs = {}
|
388
|
+
vi.map do |vk, vv|
|
389
|
+
if vv.nil?
|
390
|
+
sargs.push vk
|
391
|
+
else
|
392
|
+
skwargs[vk] = vv
|
393
|
+
end
|
394
|
+
end
|
395
|
+
set k, *sargs, **skwargs
|
396
|
+
else
|
397
|
+
set k, vi
|
398
|
+
end
|
399
|
+
end
|
400
|
+
|
401
|
+
else
|
402
|
+
|
403
|
+
if v.nil?
|
404
|
+
set k
|
405
|
+
else
|
406
|
+
set k, v
|
407
|
+
end
|
408
|
+
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
plot *(sp.args)
|
413
|
+
|
414
|
+
end # of subplot.each
|
415
|
+
|
416
|
+
unset :multiplot
|
417
|
+
|
418
|
+
end # of Numo.gnuplot
|
419
|
+
end # of def draw
|
420
|
+
|
421
|
+
module_function :histogram
|
422
|
+
module_function :note_line, :draw_line
|
423
|
+
module_function :note_box, :draw_box
|
424
|
+
module_function :note_histogram, :draw_histogram
|
425
|
+
module_function :note, :draw
|
407
426
|
|
408
|
-
module_function :note_line, :draw_line, :note_box, :draw_box, :note_histogram, :draw_histogram
|
409
427
|
end # Of module
|
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.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- showata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-gnuplot
|