ruby-gr 0.0.8 → 0.0.9
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/README.md +8 -0
- data/lib/gr.rb +1 -1
- data/lib/gr/plot.rb +23 -8
- data/lib/gr3.rb +1 -1
- data/lib/gr_commons/fiddley.rb +1 -1
- data/lib/gr_commons/gr_commons.rb +11 -0
- data/lib/gr_commons/version.rb +1 -1
- metadata +3 -3
- data/lib/gr_commons.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7feff4b6a6607304d914aa29fbd928eb8038373db422bb97ffc7f2f93e716eca
|
4
|
+
data.tar.gz: c1e8c535bcc1f7643654e355d08941aa3b063b08073ab633a271fdb91658250c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b11313f004e0e6fe8d8203be2aae5966f91404699179af1170af17fad1f4c0f48f8d8fc221813535bee6ae63fd26583520e18a15c26bac90bb79d2961090a91
|
7
|
+
data.tar.gz: c28961f5c97d923ff9b1ae713d3f04fa4f77538febbf1de2ef44fce2b2d35c639a80fb74f3bed40b8b158ad73110108795a9d5e6ac0f7790032c0274562964b0
|
data/README.md
CHANGED
@@ -6,9 +6,15 @@
|
|
6
6
|
[](https://gitter.im/red-data-tools/en)
|
7
7
|
[](https://rubydoc.info/gems/ruby-gr)
|
8
8
|
|
9
|
+
<p align="center">
|
10
|
+
<img src="https://user-images.githubusercontent.com/5798442/70857099-13d57600-1f2c-11ea-8f3c-7d81065f13a5.png">
|
11
|
+
</p>
|
12
|
+
|
9
13
|
:bar_chart: [GR framework](https://github.com/sciapp/gr) - the graphics library for visualisation - for Ruby
|
10
14
|
|
11
15
|
## Installation
|
16
|
+
GR.rb supports Ruby 2.4+.
|
17
|
+
|
12
18
|
Install [GR](https://github.com/sciapp/gr/releases).
|
13
19
|
Set environment variable GRDIR.
|
14
20
|
|
@@ -22,6 +28,8 @@ Add this line to your application's Gemfile:
|
|
22
28
|
gem 'ruby-gr'
|
23
29
|
```
|
24
30
|
|
31
|
+
GR3 and GR::Plot require [numo-narray](https://github.com/ruby-numo/numo-narray).
|
32
|
+
|
25
33
|
## Quick Start
|
26
34
|
|
27
35
|
<p align="center">
|
data/lib/gr.rb
CHANGED
data/lib/gr/plot.rb
CHANGED
@@ -40,7 +40,7 @@ module GR
|
|
40
40
|
xlog yflip ylabel ylim ylog zflip zlabel zlim zlog clim
|
41
41
|
subplot].freeze
|
42
42
|
|
43
|
-
@@last_plot
|
43
|
+
@@last_plot = nil
|
44
44
|
def self.last_plot
|
45
45
|
@@last_plot
|
46
46
|
end
|
@@ -878,7 +878,8 @@ module GR
|
|
878
878
|
args.each do |_x, _y, _z, _c, spec|
|
879
879
|
if i < num_labels
|
880
880
|
label = kvs[:labels][i]
|
881
|
-
|
881
|
+
label = label.to_s
|
882
|
+
_tbx, tby = inqtext(0, 0, label)
|
882
883
|
dy = [(tby[2] - tby[0]) - 0.03, 0].max
|
883
884
|
py -= 0.5 * dy
|
884
885
|
end
|
@@ -889,14 +890,14 @@ module GR
|
|
889
890
|
GR.restorestate
|
890
891
|
GR.settextalign(GR::TEXT_HALIGN_LEFT, GR::TEXT_VALIGN_HALF)
|
891
892
|
if i < num_labels
|
892
|
-
|
893
|
+
text(px, py, label)
|
893
894
|
py -= 0.5 * dy
|
894
895
|
i += 1
|
895
896
|
end
|
896
897
|
py -= 0.03
|
897
|
-
GR.selntran(1)
|
898
|
-
GR.restorestate
|
899
898
|
end
|
899
|
+
GR.selntran(1)
|
900
|
+
GR.restorestate
|
900
901
|
end
|
901
902
|
|
902
903
|
def to_svg
|
@@ -945,9 +946,22 @@ module GR
|
|
945
946
|
end
|
946
947
|
|
947
948
|
def plot_args(args, _fmt = :xys)
|
948
|
-
#
|
949
|
-
|
950
|
-
|
949
|
+
# FIXME
|
950
|
+
args = [args] unless args.all? { |i| i.is_a? Array }
|
951
|
+
args.map do |xyzc|
|
952
|
+
x, y, z, c = xyzc.map do |i|
|
953
|
+
if i.is_a?(Array) || narray?(i)
|
954
|
+
i
|
955
|
+
elsif i.respond_to?(:to_a)
|
956
|
+
# Convert an Array-like class such as Daru::Vector to an Array
|
957
|
+
i.to_a
|
958
|
+
else
|
959
|
+
# String
|
960
|
+
i
|
961
|
+
end
|
962
|
+
end
|
963
|
+
[x, y, z, c]
|
964
|
+
end
|
951
965
|
end
|
952
966
|
|
953
967
|
# Normalize a color c with the range [cmin, cmax]
|
@@ -1066,6 +1080,7 @@ module GR
|
|
1066
1080
|
w = 0
|
1067
1081
|
h = 0
|
1068
1082
|
kvs[:labels].each do |label|
|
1083
|
+
label = label.to_s
|
1069
1084
|
tbx, tby = inqtext(0, 0, label)
|
1070
1085
|
w = [w, tbx[2]].max
|
1071
1086
|
h += [tby[2] - tby[0], 0.03].max
|
data/lib/gr3.rb
CHANGED
data/lib/gr_commons/fiddley.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Module with common code for GR, GR3
|
4
|
+
module GRCommons
|
5
|
+
end
|
6
|
+
|
7
|
+
require_relative 'extern'
|
8
|
+
require_relative 'define_methods'
|
9
|
+
require_relative 'gr_common_utils'
|
10
|
+
require_relative 'jupyter_support'
|
11
|
+
require_relative 'version'
|
data/lib/gr_commons/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -154,11 +154,11 @@ files:
|
|
154
154
|
- lib/gr3/ffi.rb
|
155
155
|
- lib/gr3/gr3base.rb
|
156
156
|
- lib/gr3/version.rb
|
157
|
-
- lib/gr_commons.rb
|
158
157
|
- lib/gr_commons/define_methods.rb
|
159
158
|
- lib/gr_commons/extern.rb
|
160
159
|
- lib/gr_commons/fiddley.rb
|
161
160
|
- lib/gr_commons/gr_common_utils.rb
|
161
|
+
- lib/gr_commons/gr_commons.rb
|
162
162
|
- lib/gr_commons/jupyter_support.rb
|
163
163
|
- lib/gr_commons/version.rb
|
164
164
|
homepage: https://github.com/red-data-tools/GR.rb
|
data/lib/gr_commons.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Module with common code for GR, GR3
|
4
|
-
module GRCommons
|
5
|
-
end
|
6
|
-
|
7
|
-
require 'gr_commons/extern'
|
8
|
-
require 'gr_commons/define_methods'
|
9
|
-
require 'gr_commons/gr_common_utils'
|
10
|
-
require 'gr_commons/jupyter_support'
|
11
|
-
require 'gr_commons/version'
|