ruby-gr 0.61.0.0 → 0.64.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -65
- data/lib/gr/ffi.rb +2 -0
- data/lib/gr.rb +14 -4
- data/lib/gr3/ffi.rb +7 -0
- data/lib/gr_commons/version.rb +1 -1
- data/lib/grm/ffi.rb +0 -3
- metadata +17 -4
- data/lib/gr/plot.rb +0 -1553
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89e87b16084dadf1b42355615e60e8b3537179eea0d2bab51a9b482abb060036
|
4
|
+
data.tar.gz: a645e707451e939abe3d6706bcda2bc49544149c21fe0fb93785ae3162794958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf43899a660104ac091218d43be18d74f94488f04f44056a8cb09c89ce793aefaa05070dde4bf129b4601f10071b4617bccbcf573818c6d531ed61c8c354c705
|
7
|
+
data.tar.gz: 868a4a08896bce2ac780eeea5d1ebab82d56262dbc9407fb8eb1ad11bc13a71d18a6b291ac57abc3a78d021eb47b788da4d942df057a7071e191d5afaf588a71
|
data/README.md
CHANGED
@@ -27,23 +27,22 @@
|
|
27
27
|
|
28
28
|
GR.rb supports Ruby 2.5+.
|
29
29
|
|
30
|
-
First, [install GR](#gr-installation). Then install `
|
30
|
+
First, [install GR](#gr-installation). Then install `gr-plot` gem.
|
31
31
|
|
32
32
|
```sh
|
33
|
-
gem install
|
33
|
+
gem install gr-plot
|
34
34
|
```
|
35
|
-
Note: If you are using [RubyInstaller](https://rubyinstaller.org/) (Windows), pacman will automatically install [mingw-w64-gr](https://packages.msys2.org/base/mingw-w64-gr).
|
36
35
|
|
37
|
-
|
36
|
+
[pkg-config](https://github.com/ruby-gnome/pkg-config) will detect the location of the shared library. Otherwise, you need to specify the environment variable.
|
38
37
|
|
39
38
|
```sh
|
40
39
|
export GRDIR="/your/path/to/gr"
|
41
40
|
```
|
42
41
|
|
43
|
-
If you use package managers to install GR, [pkg-config](https://github.com/ruby-gnome/pkg-config) may automatically detect the shared library location without specifying the `GRDIR` environment variable.
|
44
|
-
|
45
42
|
## Quick Start
|
46
43
|
|
44
|
+
:point_right: [Wiki -plotting functions](https://github.com/red-data-tools/GR.rb/wiki/Plotting-functions)
|
45
|
+
|
47
46
|
<p align="center">
|
48
47
|
<img src="https://user-images.githubusercontent.com/5798442/69689128-74cb1480-110b-11ea-9097-29e878a19e8f.png">
|
49
48
|
</p>
|
@@ -54,41 +53,15 @@ require 'gr/plot'
|
|
54
53
|
x = [0, 0.2, 0.4, 0.6, 0.8, 1.0]
|
55
54
|
y = [0.3, 0.5, 0.4, 0.2, 0.6, 0.7]
|
56
55
|
|
56
|
+
# show the figure
|
57
57
|
GR.plot(x, y)
|
58
|
-
```
|
59
58
|
|
60
|
-
|
61
|
-
<img src="https://user-images.githubusercontent.com/5798442/84570709-242ab880-adca-11ea-9099-3a6b3418bf19.png">
|
62
|
-
</p>
|
63
|
-
|
64
|
-
```ruby
|
65
|
-
require 'gr/plot'
|
66
|
-
|
67
|
-
x = Numo::DFloat.linspace(0, 10, 101)
|
68
|
-
y1 = Numo::NMath.sin(x)
|
69
|
-
y2 = Numo::NMath.cos(x)
|
70
|
-
|
71
|
-
GR.plot(
|
72
|
-
[x, y1, 'bo'], [x, y2, 'g*'],
|
73
|
-
title: "Multiple plot example",
|
74
|
-
xlabel: "x",
|
75
|
-
ylabel: "y",
|
76
|
-
ylim: [-1.2, 1.2],
|
77
|
-
labels: ["sin(x)", "cos(x)"],
|
78
|
-
location: 11
|
79
|
-
)
|
80
|
-
```
|
81
|
-
|
82
|
-
Save the figure in PNG format.
|
83
|
-
|
84
|
-
```ruby
|
59
|
+
# Save the figure in PNG format.
|
85
60
|
GR.savefig("figure.png")
|
86
61
|
```
|
87
62
|
|
88
63
|
## API Overview
|
89
64
|
|
90
|
-
There are two different approaches when plotting with GR.rb. One is to call Matlab-like APIs. The other is to call GR/GR3 native functions.
|
91
|
-
|
92
65
|
#### GR::Plot - A simple, matlab-style API.
|
93
66
|
|
94
67
|
```ruby
|
@@ -96,8 +69,7 @@ require 'gr/plot'
|
|
96
69
|
GR.plot(x, y)
|
97
70
|
```
|
98
71
|
|
99
|
-
|
100
|
-
Some GR module methods are overwritten.
|
72
|
+
List of available functions.
|
101
73
|
|
102
74
|
[`plot`](../../wiki/Plotting-functions#plot)
|
103
75
|
[`step`](../../wiki/Plotting-functions#step)
|
@@ -123,6 +95,9 @@ Some GR module methods are overwritten.
|
|
123
95
|
[`imshow`](../../wiki/Plotting-functions#imshow)
|
124
96
|
[`isosurface`](../../wiki/Plotting-functions#isosurface)
|
125
97
|
|
98
|
+
See [GR.rb Wiki](https://github.com/red-data-tools/GR.rb/wiki) for details.
|
99
|
+
Some GR module methods are overwritten. Code has been moved to [gr-plot](https://github.com/red-data-tools/gr-plot).
|
100
|
+
|
126
101
|
#### GR - A module for calling native GR functions.
|
127
102
|
|
128
103
|
2-D Plots and common 3-D Plots.
|
@@ -159,41 +134,30 @@ export GKS_WSTYPE=100
|
|
159
134
|
## Documentation
|
160
135
|
|
161
136
|
- [GR.rb Wiki](https://github.com/red-data-tools/GR.rb/wiki)
|
162
|
-
- [GR
|
163
|
-
- [GR
|
164
|
-
|
165
|
-
Although GR.rb adds methods dynamically, we try our best to provide a complete yard document. If you want to see more up-to-date information, we recommend using the official GR reference.
|
137
|
+
- [GR.rb API Documentation](https://rubydoc.info/gems/ruby-gr) - Yard documents.
|
138
|
+
- [GR Framework](https://gr-framework.org/) - The official GR reference.
|
166
139
|
|
167
140
|
## GR Installation
|
168
141
|
|
169
142
|
### Installing an official release (recommended)
|
170
143
|
|
171
|
-
Download the [latest release](https://github.com/sciapp/gr/releases).
|
172
|
-
|
173
|
-
Set environment variable GRDIR.
|
144
|
+
Download the [latest release](https://github.com/sciapp/gr/releases) and place it where you want. Then set environment variable `GRDIR`.
|
174
145
|
|
175
146
|
```sh
|
176
147
|
export GRDIR="your/path/to/gr"
|
177
148
|
```
|
178
149
|
|
179
|
-
macOS :
|
150
|
+
macOS : See ["How to open apps from un-notarized or unidentified developers"](https://support.apple.com/en-us/HT202491) in the Apple documentation.
|
180
151
|
|
181
152
|
### Using package managers
|
182
153
|
|
183
|
-
|
184
|
-
* If you find any problem, please report the issue [here](https://github.com/red-data-tools/GR.rb/issues).
|
185
|
-
* Note: These packages may not have some features such as video output.
|
154
|
+
The third party GR packages for Mac, Linux and Windows are available for advanced users. However, these packages are provided by OSS volunteers and may not be the latest version or support some features (such as video output). If you find any problem, please report the issue [here](https://github.com/red-data-tools/GR.rb/issues).
|
186
155
|
|
187
156
|
#### Mac - Homebrew
|
188
157
|
|
189
158
|
```sh
|
190
159
|
brew install libgr
|
191
|
-
|
192
|
-
|
193
|
-
Set the workstation type to gksqt.
|
194
|
-
|
195
|
-
```sh
|
196
|
-
export GKS_WSTYPE=411 # gksqt (recommended)
|
160
|
+
export GKS_WSTYPE=411 # Set the workstation type to gksqt (recommended)
|
197
161
|
```
|
198
162
|
|
199
163
|
#### Linux - openSUSE Build service
|
@@ -220,21 +184,16 @@ Please feel free to send us your PR.
|
|
220
184
|
* Update GR packages ( Homebrew, MinGW, red-data-tools )
|
221
185
|
* Create visualization tools based on GR.rb
|
222
186
|
|
223
|
-
|
187
|
+
If you are not familiar with Ruby gem development, please see
|
188
|
+
[I'm new to Ruby](https://github.com/red-data-tools/GR.rb/wiki/I%27m-new-to-Ruby)
|
224
189
|
|
225
|
-
```
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
bundle exec rake test
|
190
|
+
```
|
191
|
+
Do you need commit rights to my repository?
|
192
|
+
Do you want to get admin rights and take over the project?
|
193
|
+
If so, please feel free to contact us.
|
230
194
|
```
|
231
195
|
|
232
|
-
|
233
|
-
|
234
|
-
## Future plans
|
235
|
-
|
236
|
-
* Creating a backend for [Charty](https://github.com/red-data-tools/charty).
|
237
|
-
* [Object-oriented interface](https://github.com/kojix2/GRUtils.rb) based on [GRUtils.jl](https://github.com/heliosdrm/GRUtils.jl).
|
196
|
+
I've seen a lot of OSS abandoned because no one has commit rights to the original repository anymore; the right to request commit rights for GR.rb is always open.
|
238
197
|
|
239
198
|
## Acknowledgements
|
240
199
|
|
data/lib/gr/ffi.rb
CHANGED
@@ -33,7 +33,9 @@ module GR
|
|
33
33
|
try_extern 'void gr_polyline(int, double *, double *)'
|
34
34
|
try_extern 'void gr_polymarker(int, double *, double *)'
|
35
35
|
try_extern 'void gr_text(double, double, char *)'
|
36
|
+
try_extern 'void gr_textx(double, double, char *, int)'
|
36
37
|
try_extern 'void gr_inqtext(double, double, char *, double *, double *)'
|
38
|
+
try_extern 'gr_inqtextx(double, double, char *, int, double *, double *)'
|
37
39
|
try_extern 'void gr_fillarea(int, double *, double *)'
|
38
40
|
try_extern 'void gr_cellarray(double, double, double, double, ' \
|
39
41
|
'int, int, int, int, int, int, int *)'
|
data/lib/gr.rb
CHANGED
@@ -2593,8 +2593,8 @@ module GR
|
|
2593
2593
|
PATH_CURVE4 = 0x04
|
2594
2594
|
PATH_CLOSEPOLY = 0x4f
|
2595
2595
|
|
2596
|
-
GDP_DRAW_PATH
|
2597
|
-
GDP_DRAW_LINES
|
2596
|
+
GDP_DRAW_PATH = 1
|
2597
|
+
GDP_DRAW_LINES = 2
|
2598
2598
|
GDP_DRAW_MARKERS = 3
|
2599
2599
|
|
2600
2600
|
MPL_SUPPRESS_CLEAR = 1
|
@@ -2640,7 +2640,17 @@ module GR
|
|
2640
2640
|
(UPSAMPLE_VERTICAL_LANCZOS | UPSAMPLE_HORIZONTAL_LANCZOS |
|
2641
2641
|
DOWNSAMPLE_VERTICAL_LANCZOS | DOWNSAMPLE_HORIZONTAL_LANCZOS)
|
2642
2642
|
|
2643
|
-
PROJECTION_DEFAULT
|
2643
|
+
PROJECTION_DEFAULT = 0
|
2644
2644
|
PROJECTION_ORTHOGRAPHIC = 1
|
2645
|
-
PROJECTION_PERSPECTIVE
|
2645
|
+
PROJECTION_PERSPECTIVE = 2
|
2646
|
+
|
2647
|
+
VOLUME_WITHOUT_BORDER = 0
|
2648
|
+
VOLUME_WITH_BORDER = 1
|
2649
|
+
|
2650
|
+
VOLUME_EMISSION = 0
|
2651
|
+
VOLUME_ABSORPTION = 1
|
2652
|
+
VOLUME_MIP = 2
|
2653
|
+
|
2654
|
+
TEXT_USE_WC = (1 << 0)
|
2655
|
+
TEXT_ENABLE_INLINE_MATH = (1 << 1)
|
2646
2656
|
end
|
data/lib/gr3/ffi.rb
CHANGED
@@ -144,5 +144,12 @@ module GR3
|
|
144
144
|
'(float left, float right, float bottom, float top, float znear, float zfar)'
|
145
145
|
try_extern 'void gr3_setsurfaceoption(int option)'
|
146
146
|
try_extern 'int gr3_getsurfaceoption(void)'
|
147
|
+
try_extern 'int gr3_getlightsources(int max_num_lights, float *positions, float *colors)'
|
148
|
+
try_extern 'int gr3_setlightsources(int num_lights, float *positions, float *colors)'
|
149
|
+
try_extern 'void gr3_setlightparameters(float ambient, float diffuse, float specular, float specular_power)'
|
150
|
+
try_extern 'void gr3_getlightparameters(float *ambient, float *diffuse, float *specular, float *specular_power)'
|
151
|
+
try_extern 'void gr3_setdefaultlightparameters()'
|
152
|
+
try_extern 'void gr3_setclipping(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)'
|
153
|
+
try_extern 'void gr3_getclipping(float *xmin, float *xmax, float *ymin, float *ymax, float *zmin, float *zmax)'
|
147
154
|
end
|
148
155
|
end
|
data/lib/gr_commons/version.rb
CHANGED
data/lib/grm/ffi.rb
CHANGED
@@ -70,8 +70,5 @@ module GRM
|
|
70
70
|
try_extern 'int grm_merge_named(const grm_args_t *args, const char *identificator)'
|
71
71
|
try_extern 'int grm_plot(const grm_args_t *args)'
|
72
72
|
try_extern 'int grm_switch(unsigned int id)'
|
73
|
-
|
74
|
-
# https://github.com/sciapp/gr/blob/master/lib/grm/util.h
|
75
|
-
try_extern 'FILE *grm_get_stdout(void)'
|
76
73
|
end
|
77
74
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-gr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.64.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fiddle
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: histogram
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,7 +77,6 @@ files:
|
|
63
77
|
- lib/gr.rb
|
64
78
|
- lib/gr/ffi.rb
|
65
79
|
- lib/gr/grbase.rb
|
66
|
-
- lib/gr/plot.rb
|
67
80
|
- lib/gr/version.rb
|
68
81
|
- lib/gr3.rb
|
69
82
|
- lib/gr3/ffi.rb
|
@@ -102,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
115
|
- !ruby/object:Gem::Version
|
103
116
|
version: '0'
|
104
117
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
118
|
+
rubygems_version: 3.3.7
|
106
119
|
signing_key:
|
107
120
|
specification_version: 4
|
108
121
|
summary: GR for Ruby
|