bplot 0.0.2.1 → 0.0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Tutorial +1 -1
  2. data/lib/bplot.rb +18 -10
  3. metadata +1 -1
data/Tutorial CHANGED
@@ -140,7 +140,7 @@ Both parameters take a style string that specifies the line-width/point-size
140
140
  and the line-type/point-type separated by a semicolon:
141
141
 
142
142
  b.plot(x, y, :lines => "2;dashed", :points => "2;open-circle")
143
- b.plot(x, y, :lines => "1;dots", :points => "1.5;filled-square")
143
+ b.plot(x, y, :lines => "1;dots", :points => "1.5;solid-square")
144
144
 
145
145
  You can leave either option blank. For example, `:lines => ";dashed"` defines
146
146
  a dashed line of the default thickness ("1"), while `:lines => "2;"` defines
data/lib/bplot.rb CHANGED
@@ -261,20 +261,25 @@ class BPlot
261
261
  if opts[:lines]
262
262
  lw, lt = opts[:lines].split(/;/)
263
263
 
264
- lw = 1 if lw == ''
264
+ lw = lw.to_i
265
+ lw = 1 if lw == 0
266
+
265
267
  lt = 1 if lt == '' or lt == nil
266
268
  lt = 1 if lt.to_s =~ /solid/i
267
269
  lt = 2 if lt.to_s =~ /dashed/i
268
- lt = 3 if lt.to_s =~ /dots/i
270
+ lt = 3 if lt.to_s =~ /dot/i
269
271
  lt = 4 if lt.to_s =~ /dot-dashed/i
270
272
  lt = 5 if lt.to_s =~ /dot-dot-dashed/i
271
273
 
272
- style << " lw #{lw} lt #{lt} "
274
+ style << " lw #{lw} " if lw.is_a?(Fixnum)
275
+ style << " lt #{lt} " if lt.is_a?(Fixnum)
273
276
  end
274
277
  if opts[:points]
275
278
  ps, pt = opts[:points].split(/;/)
276
279
 
277
- ps = 1 if ps == ''
280
+ ps = ps.to_i
281
+ ps = 1 if ps == 0
282
+
278
283
  pt = 1 if pt == ''
279
284
  pt = 1 if pt == '+'
280
285
  pt = 2 if pt == 'x' or pt == 'X'
@@ -282,18 +287,21 @@ class BPlot
282
287
  pt = 1 if pt.to_s =~ /plus/i
283
288
  pt = 2 if pt.to_s =~ /cross/i
284
289
  pt = 3 if pt.to_s =~ /star/i
290
+
285
291
  pt = 4 if pt.to_s =~ /open-square/i
286
- pt = 5 if pt.to_s =~ /solid-square/i
287
292
  pt = 6 if pt.to_s =~ /open-circle/i
288
- pt = 7 if pt.to_s =~ /solid-circle/i
293
+ pt = 12 if pt.to_s =~ /open-diamond/i
289
294
  pt = 8 if pt.to_s =~ /open-up-triangle/i
290
- pt = 9 if pt.to_s =~ /solid-up-triangle/i
291
295
  pt = 10 if pt.to_s =~ /open-down-triangle/i
292
- pt = 11 if pt.to_s =~ /solid-down-triangle/i
293
- pt = 12 if pt.to_s =~ /open-diamond/i
296
+
297
+ pt = 5 if pt.to_s =~ /solid-square/i
298
+ pt = 7 if pt.to_s =~ /solid-circle/i
294
299
  pt = 13 if pt.to_s =~ /solid-diamond/i
300
+ pt = 9 if pt.to_s =~ /solid-up-triangle/i
301
+ pt = 11 if pt.to_s =~ /solid-down-triangle/i
295
302
 
296
- style << " ps #{ps} pt #{pt} "
303
+ style << " ps #{ps} " if ps.is_a?(Fixnum)
304
+ style << " pt #{pt} " if pt.is_a?(Fixnum)
297
305
  end
298
306
 
299
307
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bplot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.1
4
+ version: 0.0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: