ruby-gr 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 668fdb6db9526bf6b55fb6b293aa776ec625b76a650be20852efcd2869f1c751
4
- data.tar.gz: 3b3a7645021470b12840734506f2a466d32fdff111c0e7dd6762ccf9e374ee92
3
+ metadata.gz: 46a782911565b4128622399489e47d79e7ced0d3880d9c5c5adacdae7fa24709
4
+ data.tar.gz: e89d9c7e5a5ae0bf53352f3afb71fd1206c9a0e7aa5a3ba83504457fa5689b7d
5
5
  SHA512:
6
- metadata.gz: 982637afaeb9be0f9b7abb631e1554fd04a2082ec7b019cb55e4f8d4ec870634f734b1b28dda8177e784a593476e0f065a924bd362ba58a881210015a7ec2f4c
7
- data.tar.gz: 5bd9205778607854747d7ab9e4c1165600792710a9c3df0452c3c306fceff7ab90d665ccb244aa4761c407f59df9c3f80413bf4663ff81643887966b87109e27
6
+ metadata.gz: 21a8aeb6c49da80f87bb764ba149ffa8c7e7bffa3ed171002d1c6963537b9f0b500a96f77eac6876c8c3a8af9601aad6c8a79dfd4e0aea6d7d356adfc59b04db
7
+ data.tar.gz: 99a2e4204e8eef936979895183d86003860e2b9b356a24bc0f132793177459fa8fc782cf8bdd4ac4c2a29fca6e77aff41d7501123e84917172009bc5b5907547
data/README.md CHANGED
@@ -50,7 +50,7 @@ GR.plot(x, y)
50
50
  ## Examples
51
51
 
52
52
  Have a look in the [`examples`](https://github.com/red-data-tools/GR.rb/tree/master/examples) directory.
53
- * [Example Gallery](https://github.com/red-data-tools/GR.rb/wiki/Example-gallery)
53
+ * [Example Gallery](https://github.com/red-data-tools/GR.rb/wiki/1.-Example-gallery)
54
54
 
55
55
  ## Features
56
56
 
data/lib/gr.rb CHANGED
@@ -52,16 +52,20 @@ module GR
52
52
  attr_accessor :ffi_lib
53
53
  end
54
54
 
55
- raise Error, 'Please set env variable GRDIR' unless ENV['GRDIR']
56
-
57
55
  # Platforms | path
58
56
  # Windows | bin/libgr.dll
59
57
  # MacOSX | lib/libGR.so (NOT .dylib)
60
58
  # Ubuntu | lib/libGR.so
61
59
  if Object.const_defined?(:RubyInstaller)
60
+ ENV['GRDIR'] ||= [
61
+ RubyInstaller::Runtime.msys2_installation.msys_path,
62
+ RubyInstaller::Runtime.msys2_installation.mingwarch
63
+ ].join(File::ALT_SEPARATOR)
62
64
  self.ffi_lib = File.expand_path('bin/libgr.dll', ENV['GRDIR'])
63
65
  RubyInstaller::Runtime.add_dll_directory(File.dirname(ffi_lib))
64
66
  else
67
+ raise Error, 'Please set env variable GRDIR' unless ENV['GRDIR']
68
+
65
69
  self.ffi_lib = File.expand_path('lib/libGR.so', ENV['GRDIR'])
66
70
  end
67
71
 
@@ -332,7 +332,7 @@ module GR
332
332
  GR.axes(xtick, ytick, xorg[1], yorg[1], -majorx, -majory, -ticksize)
333
333
  end
334
334
 
335
- if kvs.has_key?(:title)
335
+ if kvs[:title]
336
336
  GR.savestate
337
337
  GR.settextalign(GR::TEXT_HALIGN_CENTER, GR::TEXT_VALIGN_TOP)
338
338
  text(0.5 * (viewport[0] + viewport[1]), vp[3], kvs[:title])
@@ -700,11 +700,18 @@ module GR
700
700
  a, b = z.shape
701
701
  x = (1..b).to_a
702
702
  y = (1..a).to_a
703
- zmin, zmax = kvs[:zlim] || z.minmax
703
+ zmin, zmax = z.minmax
704
704
  elsif equal_length(x, y, z)
705
705
  x, y, z = GR.gridit(x, y, z, 200, 200)
706
- zmin, zmax = kvs[:zlim] || z.compact.minmax # compact : removed nil
706
+ zmin, zmax = z.compact.minmax # compact : removed nil
707
+ end
708
+
709
+ # kvs[:zlim] is supposed to be Array or Range
710
+ if kvs.has_key?(:zlim)
711
+ zmin = kvs[:zlim].first if kvs[:zlim].first
712
+ zmax = kvs[:zlim].last if kvs[:zlim].last
707
713
  end
714
+
708
715
  GR.setspace(zmin, zmax, 0, 90)
709
716
  levels = kvs[:levels] || 0
710
717
  clabels = kvs[:clabels] || false
@@ -1093,30 +1100,12 @@ module GR
1093
1100
  xmin, xmax = fix_minmax(xmin, xmax)
1094
1101
  ymin, ymax = fix_minmax(ymin, ymax)
1095
1102
  zmin, zmax = fix_minmax(zmin, zmax)
1096
- if kvs.has_key?(:xlim)
1097
- x0, x1 = kvs[:xlim]
1098
- x0 ||= xmin
1099
- x1 ||= xmax
1100
- kvs[:xrange] = [x0, x1]
1101
- else
1102
- kvs[:xrange] = [xmin, xmax]
1103
- end
1104
- if kvs.has_key?(:ylim)
1105
- y0, y1 = kvs[:ylim]
1106
- y0 ||= ymin
1107
- y1 ||= ymax
1108
- kvs[:yrange] = [y0, y1]
1109
- else
1110
- kvs[:yrange] = [ymin, ymax]
1111
- end
1112
- if kvs.has_key?(:zlim)
1113
- z0, z1 = kvs[:zlim]
1114
- z0 ||= zmin
1115
- z1 ||= zmax
1116
- kvs[:zrange] = [z0, z1]
1117
- else
1118
- kvs[:zrange] = [zmin, zmax]
1119
- end
1103
+
1104
+ # kvs[:xlim], kvs[:ylim], kvs[:zlim] is supposed to be Array or Range
1105
+ kvs[:xrange] = [(kvs[:xlim]&.first || xmin), (kvs[:xlim]&.last || xmax)]
1106
+ kvs[:yrange] = [(kvs[:ylim]&.first || ymin), (kvs[:ylim]&.last || ymax)]
1107
+ kvs[:zrange] = [(kvs[:zlim]&.first || zmin), (kvs[:zlim]&.last || zmax)]
1108
+
1120
1109
  if kvs.has_key?(:clim)
1121
1110
  c0, c1 = kvs[:clim]
1122
1111
  c0 ||= cmin
data/lib/gr3.rb CHANGED
@@ -60,16 +60,20 @@ module GR3
60
60
  attr_accessor :ffi_lib
61
61
  end
62
62
 
63
- raise Error, 'Please set env variable GRDIR' unless ENV['GRDIR']
64
-
65
63
  # Platforms | path
66
64
  # Windows | bin/libGR3.dll
67
65
  # MacOSX | lib/libGR3.so (NOT .dylib)
68
66
  # Ubuntu | lib/libGR3.so
69
67
  if Object.const_defined?(:RubyInstaller)
68
+ ENV['GRDIR'] ||= [
69
+ RubyInstaller::Runtime.msys2_installation.msys_path,
70
+ RubyInstaller::Runtime.msys2_installation.mingwarch
71
+ ].join(File::ALT_SEPARATOR)
70
72
  self.ffi_lib = File.expand_path('bin/libGR3.dll', ENV['GRDIR'])
71
73
  RubyInstaller::Runtime.add_dll_directory(File.dirname(ffi_lib))
72
74
  else
75
+ raise Error, 'Please set env variable GRDIR' unless ENV['GRDIR']
76
+
73
77
  self.ffi_lib = File.expand_path('lib/libGR3.so', ENV['GRDIR'])
74
78
  end
75
79
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GRCommons
4
- VERSION = '0.0.17'
4
+ VERSION = '0.0.18'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-gr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-03 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -150,7 +150,8 @@ files:
150
150
  homepage: https://github.com/red-data-tools/GR.rb
151
151
  licenses:
152
152
  - MIT
153
- metadata: {}
153
+ metadata:
154
+ msys2_mingw_dependencies: gr
154
155
  post_install_message:
155
156
  rdoc_options: []
156
157
  require_paths: