ruby-gr 0.0.20 → 0.0.25
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/LICENSE.txt +2 -2
- data/README.md +44 -36
- data/lib/gr.rb +1022 -843
- data/lib/gr/ffi.rb +5 -2
- data/lib/gr/plot.rb +93 -41
- data/lib/gr3.rb +305 -246
- data/lib/gr3/ffi.rb +1 -1
- data/lib/gr_commons/define_methods.rb +5 -5
- data/lib/gr_commons/fiddley.rb +7 -7
- data/lib/gr_commons/gr_common_utils.rb +4 -4
- data/lib/gr_commons/gr_commons.rb +5 -1
- data/lib/gr_commons/gr_lib.rb +83 -0
- data/lib/gr_commons/gr_logger.rb +106 -0
- data/lib/gr_commons/jupyter_support.rb +5 -5
- data/lib/gr_commons/{extern.rb → try_extern.rb} +1 -1
- data/lib/gr_commons/version.rb +1 -1
- data/lib/grm.rb +34 -17
- data/lib/grm/ffi.rb +28 -14
- metadata +21 -6
- data/lib/gr/plot.rb.md +0 -172
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 684689c3494cbf841d908396c562fb418796d25afabd0a5d9c58497a8dca6a32
|
4
|
+
data.tar.gz: 3274ea957c350ddc0ec0abd5c260e54e933ab80930dba7bf5252d807bc47c770
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00b957ba8bf7f2f63b67cba456fd0016a8cc18503bbee605e3f02001e61ee377d02d7800eaacfe3077878a3cb92b8ecd9987378a40acae018ddc2428f699f2c4
|
7
|
+
data.tar.gz: ed6aaaf3a5ca30ecdf5695623b36036afe00610c720bef330ae25922fce12ad7c76a42ff8801066c3dccf4d973a77d83861651998b7da960c4b5bea7d236fa47
|
data/LICENSE.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2019 kojix2
|
4
|
-
Copyright (c) 2019 Red Data Tools
|
3
|
+
Copyright (c) 2019 - present kojix2
|
4
|
+
Copyright (c) 2019 - present Red Data Tools
|
5
5
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,43 +1,47 @@
|
|
1
1
|
# GR.rb
|
2
2
|
|
3
|
-
[](https://badge.fury.io/rb/ruby-gr)
|
3
|
+
[](https://rubygems.org/gems/ruby-gr)
|
4
|
+
[](https://github.com/red-data-tools/GR.rb/actions)
|
6
5
|
[](https://gitter.im/red-data-tools/en)
|
7
6
|
[](https://rubydoc.info/gems/ruby-gr)
|
8
7
|
|
9
|
-

|
10
|
-

|
11
|
-

|
12
|
-

|
13
|
-

|
14
|
-

|
15
|
-

|
16
|
-

|
17
|
-

|
18
|
-

|
19
|
-

|
20
|
-

|
21
|
-

|
22
|
-

|
23
|
-

|
8
|
+
[](examples/rdatasets.rb)
|
9
|
+
[](examples/fast_plots.rb)
|
10
|
+
[](examples/fast_plots.rb)
|
11
|
+
[](examples/fast_plots.rb)
|
12
|
+
[](examples/fast_plots.rb)
|
13
|
+
[](examples/fast_plots.rb)
|
14
|
+
[](examples/griddata.rb)
|
15
|
+
[](examples/2darray.rb)
|
16
|
+
[](examples/2dpolararray.rb)
|
17
|
+
[](examples/hexbin.rb)
|
18
|
+
[](examples/rdatasets.rb)
|
19
|
+
[](examples/rdatasets.rb)
|
20
|
+
[](examples/kws2.rb)
|
21
|
+
[](examples/face.rb)
|
22
|
+
[](examples/shade_ex.rb)
|
24
23
|
|
25
24
|
:bar_chart: [GR framework](https://github.com/sciapp/gr) - powerful visualization library - for Ruby
|
26
25
|
|
27
26
|
## Installation
|
28
27
|
|
29
|
-
GR.rb supports Ruby 2.
|
28
|
+
GR.rb supports Ruby 2.5+.
|
30
29
|
|
31
|
-
First, [install GR](#gr-installation).
|
30
|
+
First, [install GR](#gr-installation). Then install `ruby-gr` gem.
|
32
31
|
|
33
32
|
```sh
|
34
|
-
|
33
|
+
gem install ruby-gr
|
35
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
|
+
|
37
|
+
Set environment variable `GRDIR`.
|
36
38
|
|
37
39
|
```sh
|
38
|
-
|
40
|
+
export GRDIR="/your/path/to/gr"
|
39
41
|
```
|
40
42
|
|
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
|
+
|
41
45
|
## Quick Start
|
42
46
|
|
43
47
|
<p align="center">
|
@@ -83,7 +87,7 @@ GR.savefig("figure.png")
|
|
83
87
|
|
84
88
|
## API Overview
|
85
89
|
|
86
|
-
There are two different approaches to plotting with GR.rb. One way is to call Matlab-like APIs. The other is to call GR/GR3 native functions.
|
90
|
+
There are two different approaches to plotting with GR.rb. One way is to call Matlab-like APIs. The other is to call GR/GR3 native functions.
|
87
91
|
|
88
92
|
#### GR::Plot - A simple, matlab-style API.
|
89
93
|
|
@@ -93,6 +97,7 @@ GR.plot(x, y)
|
|
93
97
|
```
|
94
98
|
|
95
99
|
List of vailable functions. See [GR.rb Wiki](https://github.com/red-data-tools/GR.rb/wiki) for details.
|
100
|
+
Some GR module methods are overridden.
|
96
101
|
|
97
102
|
[`plot`](../../wiki/Plotting-functions#plot)
|
98
103
|
[`step`](../../wiki/Plotting-functions#step)
|
@@ -118,6 +123,8 @@ List of vailable functions. See [GR.rb Wiki](https://github.com/red-data-tools/G
|
|
118
123
|
[`imshow`](../../wiki/Plotting-functions#imshow)
|
119
124
|
[`isosurface`](../../wiki/Plotting-functions#isosurface)
|
120
125
|
|
126
|
+
We are planning to prepare a [more object-oriented interface](https://github.com/kojix2/GRUtils.rb) based on [GRUtils.jl](https://github.com/heliosdrm/GRUtils.jl) in the future.
|
127
|
+
|
121
128
|
#### GR - A module for calling native GR functions.
|
122
129
|
|
123
130
|
2-D Plots and common 3-D Plots.
|
@@ -147,6 +154,8 @@ GR3.cameralookat(-3, 2, -2, 0, 0, 0, 0, 0, -1)
|
|
147
154
|
- [GR Framework](https://gr-framework.org/)
|
148
155
|
- [GR.rb API Documentation](https://rubydoc.info/gems/ruby-gr)
|
149
156
|
|
157
|
+
Although GR.rb adds methods dynamically, we try our best to provide a complete yard document. However, if you want to see more up-to-date information, we recommend using the official GR reference.
|
158
|
+
|
150
159
|
## GR Installation
|
151
160
|
|
152
161
|
### Installing an official release (recommended)
|
@@ -161,10 +170,11 @@ export GRDIR="your/path/to/gr"
|
|
161
170
|
|
162
171
|
* macOS Catalina and macOS Mojave: See the "How to open an app that hasn’t been notarized or is from an unidentified developer" section of [Safely open apps on your Mac](https://support.apple.com/en-us/HT202491) in the Apple documentation.
|
163
172
|
|
164
|
-
### Using
|
173
|
+
### Using package managers
|
165
174
|
|
166
175
|
* The third party GR packages for Mac, Linux and Windows are available (for advanced users).
|
167
176
|
* If you find any problem, please report the issue [here](https://github.com/red-data-tools/GR.rb/issues).
|
177
|
+
* Note: These packages may not have some features, for example, video output.
|
168
178
|
|
169
179
|
#### Mac - Homebrew
|
170
180
|
|
@@ -172,17 +182,11 @@ export GRDIR="your/path/to/gr"
|
|
172
182
|
brew install libgr
|
173
183
|
```
|
174
184
|
|
175
|
-
Set environment variable `GRDIR`.
|
176
|
-
|
177
|
-
```sh
|
178
|
-
export GRDIR=$(brew --prefix libgr)
|
179
|
-
```
|
180
|
-
|
181
185
|
#### Linux - APT Yum
|
182
186
|
|
183
|
-
[packages.red-data-tools.org](https://github.com/red-data-tools/packages.red-data-tools.org) provides `libgr-dev` and `
|
187
|
+
[packages.red-data-tools.org](https://github.com/red-data-tools/packages.red-data-tools.org) provides `libgr-dev`, `libgr3-dev` and `libgrm-dev`
|
184
188
|
|
185
|
-
|
189
|
+
### Windows - MSYS2
|
186
190
|
|
187
191
|
If you are using Rubyinstaller, pacman will automatically install [mingw-w64-gr](https://packages.msys2.org/base/mingw-w64-gr) when the gem is installed.
|
188
192
|
|
@@ -192,13 +196,17 @@ GR.rb will be the default backend for [Charty](https://github.com/red-data-tools
|
|
192
196
|
|
193
197
|
## Contributing
|
194
198
|
|
195
|
-
|
196
|
-
|
199
|
+
GR.rb is a library under development, so even small improvements like typofix are welcome!
|
200
|
+
Please feel free to send us your PR.
|
201
|
+
|
202
|
+
* [Report bugs](https://github.com/red-data-tools/GR.rb/issues)
|
203
|
+
* Fix bugs and [submit pull requests](https://github.com/red-data-tools/GR.rb/pulls)
|
197
204
|
* Write, clarify, or fix documentation
|
198
205
|
* Suggest or add new features
|
199
|
-
*
|
206
|
+
* Update GR packages ( Homebrew, MinGW, red-data-tools )
|
207
|
+
* Create visualization tools based on GR.rb
|
200
208
|
|
201
209
|
## Acknowledgements
|
202
210
|
|
203
|
-
We would like to thank Josef Heinen, the creator of [GR.jl](https://github.com/jheinen/GR.jl), Florian Rhiem, the creator of
|
211
|
+
We would like to thank Josef Heinen, the creator of [GR](https://github.com/sciapp/gr) and [GR.jl](https://github.com/jheinen/GR.jl), Florian Rhiem, the creator of [python-gr](https://github.com/sciapp/python-gr), and all [GR](https://github.com/sciapp/gr) developers.
|
204
212
|
|
data/lib/gr.rb
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
# | +--------------+ |
|
37
37
|
# +------------------+
|
38
38
|
#
|
39
|
-
# (You can edit the above AA diagram with http://asciiflow.com/)
|
39
|
+
# (You can edit the above AA diagram with http://asciiflow.com/)
|
40
40
|
#
|
41
41
|
# Fiddley is Ruby-FFI compatible API layer for Fiddle.
|
42
42
|
#
|
@@ -48,31 +48,34 @@
|
|
48
48
|
module GR
|
49
49
|
class Error < StandardError; end
|
50
50
|
|
51
|
+
class NotFoundError < Error; end
|
52
|
+
|
51
53
|
class << self
|
52
54
|
attr_accessor :ffi_lib
|
53
55
|
end
|
54
56
|
|
57
|
+
require_relative 'gr_commons/gr_commons'
|
58
|
+
|
55
59
|
# Platforms | path
|
56
60
|
# Windows | bin/libgr.dll
|
57
|
-
# MacOSX | lib/libGR.so (
|
61
|
+
# MacOSX | lib/libGR.so (v0.53.0 .so)
|
58
62
|
# Ubuntu | lib/libGR.so
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
63
|
+
platform = RbConfig::CONFIG['host_os']
|
64
|
+
lib_names, pkg_name = \
|
65
|
+
case platform
|
66
|
+
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
67
|
+
[['libGR.dll'], 'gr']
|
68
|
+
when /darwin|mac os/
|
69
|
+
[['libGR.dylib', 'libGR.so'], 'gr']
|
70
|
+
else
|
71
|
+
[['libGR.so'], 'gr']
|
72
|
+
end
|
73
|
+
lib_path = GRCommons::GRLib.search(lib_names, pkg_name)
|
71
74
|
|
72
|
-
|
73
|
-
|
75
|
+
raise NotFoundError, "#{lib_names} not found" if lib_path.nil?
|
76
|
+
|
77
|
+
self.ffi_lib = lib_path
|
74
78
|
|
75
|
-
require_relative 'gr_commons/gr_commons'
|
76
79
|
require_relative 'gr/version'
|
77
80
|
require_relative 'gr/ffi'
|
78
81
|
require_relative 'gr/grbase'
|
@@ -88,22 +91,21 @@ module GR
|
|
88
91
|
# a Fiddley::MemoryPointer in the GRBase class.
|
89
92
|
extend GRBase
|
90
93
|
|
91
|
-
# Now you can see a lot of methods just calling super here.
|
92
|
-
# They are written to help the yard generate the documentation.
|
93
94
|
class << self
|
94
|
-
|
95
|
-
super
|
96
|
-
end
|
95
|
+
# @!method initgr
|
97
96
|
|
98
|
-
|
99
|
-
super
|
100
|
-
end
|
97
|
+
# @!method opengks
|
101
98
|
|
102
|
-
|
103
|
-
super
|
104
|
-
end
|
99
|
+
# @!method closegks
|
105
100
|
|
106
|
-
#
|
101
|
+
# Get the current display size.
|
102
|
+
#
|
103
|
+
# Depending on the current workstation type, the current display might be
|
104
|
+
# the primary screen (e.g. when using gksqt or GKSTerm) or a purely virtual
|
105
|
+
# display (e.g. when using Cairo). When a high DPI screen is used as the
|
106
|
+
# current display, width and height will be in logical pixels.
|
107
|
+
#
|
108
|
+
# @return [Array] meter_width, meter_height, width, height
|
107
109
|
def inqdspsize
|
108
110
|
inquiry %i[double double int int] do |*pts|
|
109
111
|
super(*pts)
|
@@ -111,13 +113,12 @@ module GR
|
|
111
113
|
end
|
112
114
|
|
113
115
|
# Open a graphical workstation.
|
116
|
+
#
|
114
117
|
# @param workstation_id [Integer] A workstation identifier.
|
115
118
|
# @param connection [String] A connection identifier.
|
116
119
|
# @param workstation_type [Integer] The desired workstation type.
|
117
120
|
# * 5 : Workstation Independent Segment Storage
|
118
|
-
# * 7, 8 : Computer Graphics Metafile (CGM binary, clear text)
|
119
121
|
# * 41 : Windows GDI
|
120
|
-
# * 51 : Mac Quickdraw
|
121
122
|
# * 61 - 64 : PostScript (b/w, color)
|
122
123
|
# * 101, 102 : Portable Document Format (plain, compressed)
|
123
124
|
# * 210 - 213 : X Windows
|
@@ -138,70 +139,82 @@ module GR
|
|
138
139
|
# * 410 : Socket driver
|
139
140
|
# * 415 : 0MQ driver
|
140
141
|
# * 420 : OpenGL
|
141
|
-
#
|
142
|
-
|
143
|
-
super
|
144
|
-
end
|
142
|
+
#
|
143
|
+
# @!method openws
|
145
144
|
|
146
145
|
# Close the specified workstation.
|
146
|
+
#
|
147
147
|
# @param workstation_id [Integer] A workstation identifier.
|
148
|
-
|
149
|
-
|
150
|
-
end
|
148
|
+
#
|
149
|
+
# @!method closews
|
151
150
|
|
152
151
|
# Activate the specified workstation.
|
152
|
+
#
|
153
153
|
# @param workstation_id [Integer] A workstation identifier.
|
154
|
-
|
155
|
-
|
156
|
-
end
|
154
|
+
#
|
155
|
+
# @!method activatews
|
157
156
|
|
158
157
|
# Deactivate the specified workstation.
|
158
|
+
#
|
159
159
|
# @param workstation_id [Integer] A workstation identifier.
|
160
|
-
|
161
|
-
|
162
|
-
end
|
160
|
+
#
|
161
|
+
# @!method deactivatews
|
163
162
|
|
164
|
-
|
165
|
-
|
166
|
-
|
163
|
+
# Configure the specified workstation.
|
164
|
+
#
|
165
|
+
# @!method configurews
|
167
166
|
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
# Clear the specified workstation.
|
168
|
+
#
|
169
|
+
# @!method clearws
|
171
170
|
|
172
|
-
|
173
|
-
|
174
|
-
|
171
|
+
# Update the specified workstation.
|
172
|
+
#
|
173
|
+
# @!method updatews
|
175
174
|
|
176
175
|
# Draw a polyline using the current line attributes,
|
177
176
|
# starting from the first data point and ending at the last data point.
|
177
|
+
#
|
178
178
|
# @param x [Array, NArray] A list containing the X coordinates
|
179
179
|
# @param y [Array, NArray] A list containing the Y coordinates
|
180
|
+
#
|
181
|
+
# The values for x and y are in world coordinates.
|
182
|
+
# The attributes that control the appearance of a polyline are linetype,
|
183
|
+
# linewidth and color index.
|
184
|
+
#
|
180
185
|
def polyline(x, y)
|
181
186
|
n = equal_length(x, y)
|
182
187
|
super(n, x, y)
|
183
188
|
end
|
184
189
|
|
185
190
|
# Draw marker symbols centered at the given data points.
|
191
|
+
#
|
186
192
|
# @param x [Array, NArray] A list containing the X coordinates
|
187
193
|
# @param y [Array, NArray] A list containing the Y coordinates
|
194
|
+
#
|
195
|
+
# The values for x and y are in world coordinates.
|
196
|
+
# The attributes that control the appearance of a polymarker are marker type,
|
197
|
+
# marker size scale factor and color index.
|
198
|
+
#
|
188
199
|
def polymarker(x, y)
|
189
200
|
n = equal_length(x, y)
|
190
201
|
super(n, x, y)
|
191
202
|
end
|
192
203
|
|
193
204
|
# Draw a text at position `x`, `y` using the current text attributes.
|
194
|
-
#
|
195
|
-
# @param
|
196
|
-
#
|
205
|
+
#
|
206
|
+
# @param x [Numeric] The X coordinate of starting position of the text
|
207
|
+
# string
|
208
|
+
# @param y [Numeric] The Y coordinate of starting position of the text
|
209
|
+
# string
|
210
|
+
# @param string [String] The text to be drawn
|
197
211
|
#
|
198
212
|
# The values for `x` and `y` are in normalized device coordinates.
|
199
|
-
# The attributes that control the appearance of text are text font and
|
200
|
-
# character expansion factor, character spacing, text color index,
|
201
|
-
# height, character up vector, text path and text alignment.
|
202
|
-
|
203
|
-
|
204
|
-
end
|
213
|
+
# The attributes that control the appearance of text are text font and
|
214
|
+
# precision, character expansion factor, character spacing, text color index,
|
215
|
+
# character height, character up vector, text path and text alignment.
|
216
|
+
#
|
217
|
+
# @!method text
|
205
218
|
|
206
219
|
def inqtext(x, y, string)
|
207
220
|
inquiry [{ double: 4 }, { double: 4 }] do |tbx, tby|
|
@@ -210,11 +223,13 @@ module GR
|
|
210
223
|
end
|
211
224
|
|
212
225
|
# Allows you to specify a polygonal shape of an area to be filled.
|
226
|
+
#
|
213
227
|
# @param x [Array, NArray] A list containing the X coordinates
|
214
228
|
# @param y [Array, NArray] A list containing the Y coordinates
|
215
229
|
#
|
216
|
-
# The attributes that control the appearance of fill areas are fill area
|
217
|
-
# style, fill area style index and fill area color index.
|
230
|
+
# The attributes that control the appearance of fill areas are fill area
|
231
|
+
# interior style, fill area style index and fill area color index.
|
232
|
+
#
|
218
233
|
def fillarea(x, y)
|
219
234
|
n = equal_length(x, y)
|
220
235
|
super(n, x, y)
|
@@ -224,28 +239,33 @@ module GR
|
|
224
239
|
# function partitions a rectangle given by two corner points into DIMX X DIMY
|
225
240
|
# cells, each of them colored individually by the corresponding color index
|
226
241
|
# of the given cell array.
|
227
|
-
#
|
228
|
-
# @param
|
229
|
-
# @param
|
230
|
-
# @param
|
231
|
-
# @param
|
232
|
-
# @param
|
242
|
+
#
|
243
|
+
# @param xmin [Numeric] Lower left point of the rectangle
|
244
|
+
# @param ymin [Numeric] Lower left point of the rectangle
|
245
|
+
# @param xmax [Numeric] Upper right point of the rectangle
|
246
|
+
# @param ymax [Numeric] Upper right point of the rectangle
|
247
|
+
# @param dimx [Integer] X dimension of the color index array
|
248
|
+
# @param dimy [Integer] Y dimension of the color index array
|
233
249
|
# @param color [Array, NArray] Color index array
|
234
250
|
#
|
235
251
|
# The values for `xmin`, `xmax`, `ymin` and `ymax` are in world coordinates.
|
252
|
+
#
|
236
253
|
def cellarray(xmin, xmax, ymin, ymax, dimx, dimy, color)
|
237
254
|
super(xmin, xmax, ymin, ymax, dimx, dimy, 1, 1, dimx, dimy, int(color))
|
238
255
|
end
|
239
256
|
|
240
257
|
# Display a two dimensional color index array with nonuniform cell sizes.
|
241
|
-
#
|
242
|
-
# @param
|
243
|
-
# @param
|
244
|
-
# @param
|
258
|
+
#
|
259
|
+
# @param x [Array, NArray] X coordinates of the cell edges
|
260
|
+
# @param y [Array, NArray] Y coordinates of the cell edges
|
261
|
+
# @param dimx [Integer] X dimension of the color index array
|
262
|
+
# @param dimy [Integer] Y dimension of the color index array
|
245
263
|
# @param color [Array, NArray] Color index array
|
264
|
+
#
|
246
265
|
# The values for `x` and `y` are in world coordinates. `x` must contain
|
247
266
|
# `dimx` + 1 elements and `y` must contain `dimy` + 1 elements. The elements
|
248
267
|
# i and i+1 are respectively the edges of the i-th cell in X and Y direction.
|
268
|
+
#
|
249
269
|
def nonuniformcellarray(x, y, dimx, dimy, color)
|
250
270
|
raise ArgumentError unless x.length == dimx + 1 && y.length == dimy + 1
|
251
271
|
|
@@ -254,20 +274,46 @@ module GR
|
|
254
274
|
|
255
275
|
# Display a two dimensional color index array mapped to a disk using polar
|
256
276
|
# coordinates.
|
257
|
-
# @param xorg [Numeric] X coordinate of the disk center in world coordinates
|
258
|
-
# @param yorg [Numeric] Y coordinate of the disk center in world coordinates
|
259
|
-
# @param phimin [Numeric] start angle of the disk sector in degrees
|
260
|
-
# @param phimax [Numeric] end angle of the disk sector in degrees
|
261
|
-
# @param rmin [Numeric] inner radius of the punctured disk in world coordinates
|
262
|
-
# @param rmax [Numeric] outer radius of the punctured disk in world coordinates
|
263
|
-
# @param dimiphi [Integer] Phi (X) dimension of the color index array
|
264
|
-
# @param dimr [Integer] iR (Y) dimension of the color index array
|
265
|
-
# @param color [Array, NArray] Color index array
|
266
277
|
#
|
267
278
|
# The two dimensional color index array is mapped to the resulting image by
|
268
|
-
# interpreting the X-axis of the array as the angle and the Y-axis as the
|
269
|
-
# The center point of the resulting disk is located at `xorg`, `yorg`
|
270
|
-
# radius of the disk is `rmax`.
|
279
|
+
# interpreting the X-axis of the array as the angle and the Y-axis as the
|
280
|
+
# raidus. The center point of the resulting disk is located at `xorg`, `yorg`
|
281
|
+
# and the radius of the disk is `rmax`.
|
282
|
+
#
|
283
|
+
# @param xorg [Numeric] X coordinate of the disk center in world
|
284
|
+
# coordinates
|
285
|
+
# @param yorg [Numeric] Y coordinate of the disk center in world
|
286
|
+
# coordinates
|
287
|
+
# @param phimin [Numeric] start angle of the disk sector in degrees
|
288
|
+
# @param phimax [Numeric] end angle of the disk sector in degrees
|
289
|
+
# @param rmin [Numeric] inner radius of the punctured disk in world
|
290
|
+
# coordinates
|
291
|
+
# @param rmax [Numeric] outer radius of the punctured disk in world
|
292
|
+
# coordinates
|
293
|
+
# @param dimiphi [Integer] Phi (X) dimension of the color index array
|
294
|
+
# @param dimr [Integer] iR (Y) dimension of the color index array
|
295
|
+
# @param color [Array, NArray] Color index array
|
296
|
+
#
|
297
|
+
# The additional parameters to the function can be used to further control
|
298
|
+
# the mapping from polar to cartesian coordinates.
|
299
|
+
#
|
300
|
+
# If `rmin` is greater than 0 the input data is mapped to a punctured disk
|
301
|
+
# (or annulus) with an inner radius of `rmin` and an outer radius `rmax`. If
|
302
|
+
# `rmin` is greater than `rmax` the Y-axis of the array is reversed.
|
303
|
+
#
|
304
|
+
# The parameter `phimin` and `phimax` can be used to map the data to a
|
305
|
+
# sector of the (punctured) disk starting at `phimin` and ending at `phimax`.
|
306
|
+
# If `phimin` is greater than `phimax` the X-axis is reversed. The visible
|
307
|
+
# sector is the one starting in mathematically positive direction
|
308
|
+
# (counterclockwise) at the smaller angle and ending at the larger angle.
|
309
|
+
# An example of the four possible options can be found below:
|
310
|
+
#
|
311
|
+
# * phimin phimax Result
|
312
|
+
# * 90 270 Left half visible, mapped counterclockwise
|
313
|
+
# * 270 90 Left half visible, mapped clockwise
|
314
|
+
# * -90 90 Right half visible, mapped counterclockwise
|
315
|
+
# * 90 -90 Right half visible, mapped clockwise
|
316
|
+
#
|
271
317
|
def polarcellarray(x_org, y_org, phimin, phimax, rmin, rmax, dimphi, dimr, color)
|
272
318
|
super(x_org, y_org, phimin, phimax, rmin, rmax, dimphi, dimr, 1, 1, dimphi, dimr, int(color))
|
273
319
|
end
|
@@ -275,10 +321,12 @@ module GR
|
|
275
321
|
# Generates a generalized drawing primitive (GDP) of the type you specify,
|
276
322
|
# using specified points and any additional information contained in a data
|
277
323
|
# record.
|
278
|
-
#
|
279
|
-
# @param
|
280
|
-
# @param
|
324
|
+
#
|
325
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
326
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
327
|
+
# @param primid [Integer] Primitive identifier
|
281
328
|
# @param datrec [Array, NArray] Primitive data record
|
329
|
+
#
|
282
330
|
def gdp(x, y, primid, datrec)
|
283
331
|
n = equal_length(x, y)
|
284
332
|
ldr = datrec.length
|
@@ -287,21 +335,35 @@ module GR
|
|
287
335
|
|
288
336
|
# Generate a cubic spline-fit,
|
289
337
|
# starting from the first data point and ending at the last data point.
|
290
|
-
#
|
291
|
-
# @param
|
292
|
-
# @param
|
293
|
-
# @param
|
338
|
+
#
|
339
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
340
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
341
|
+
# @param m [Integer] The number of points in the polygon to be
|
342
|
+
# drawn (`m` > len(`x`))
|
343
|
+
# @param method [Integer] The smoothing method
|
294
344
|
# * If `method` is > 0, then a generalized cross-validated smoothing spline is calculated.
|
295
345
|
# * If `method` is 0, then an interpolating natural cubic spline is calculated.
|
296
346
|
# * If `method` is < -1, then a cubic B-spline is calculated.
|
347
|
+
#
|
297
348
|
# The values for `x` and `y` are in world coordinates. The attributes that
|
298
349
|
# control the appearance of a spline-fit are linetype, linewidth and color
|
299
350
|
# index.
|
351
|
+
#
|
300
352
|
def spline(x, y, m, method)
|
301
353
|
n = equal_length(x, y)
|
302
354
|
super(n, x, y, m, method)
|
303
355
|
end
|
304
356
|
|
357
|
+
# Interpolate data from arbitrary points at points on a rectangular grid.
|
358
|
+
#
|
359
|
+
# @param xd [Array, NArray] X coordinates of the input points
|
360
|
+
# @param yd [Array, NArray] Y coordinates of the input points
|
361
|
+
# @param zd [Array, NArray] values of the points
|
362
|
+
# @param nx [Array, NArray] The number of points in X direction for the
|
363
|
+
# output grid
|
364
|
+
# @param ny [Array, NArray] The number of points in Y direction for the
|
365
|
+
# output grid
|
366
|
+
#
|
305
367
|
def gridit(xd, yd, zd, nx, ny)
|
306
368
|
nd = equal_length(xd, yd, zd)
|
307
369
|
inquiry [{ double: nx }, { double: ny }, { double: nx * ny }] do |px, py, pz|
|
@@ -310,173 +372,130 @@ module GR
|
|
310
372
|
end
|
311
373
|
|
312
374
|
# Specify the line style for polylines.
|
375
|
+
#
|
313
376
|
# @param style [Integer] The polyline line style
|
314
|
-
# * 1 : LINETYPE_SOLID
|
315
|
-
#
|
316
|
-
# *
|
317
|
-
#
|
318
|
-
# *
|
319
|
-
#
|
320
|
-
# *
|
321
|
-
#
|
322
|
-
# * -
|
323
|
-
#
|
324
|
-
# * -
|
325
|
-
#
|
326
|
-
#
|
327
|
-
#
|
328
|
-
# * -4 : LINETYPE_LONG_SHORT_DASH
|
329
|
-
# * Sequence of a long dash followed by a short dash
|
330
|
-
# * -5 : LINETYPE_SPACED_DASH
|
331
|
-
# * Sequence of dashes double spaced
|
332
|
-
# * -6 : LINETYPE_SPACED_DOT
|
333
|
-
# * Sequence of dots double spaced
|
334
|
-
# * -7 : LINETYPE_DOUBLE_DOT
|
335
|
-
# * Sequence of pairs of dots
|
336
|
-
# * -8 : LINETYPE_TRIPLE_DOT
|
337
|
-
# * Sequence of groups of three dots
|
338
|
-
def setlinetype(*)
|
339
|
-
super
|
340
|
-
end
|
377
|
+
# * 1 : LINETYPE_SOLID - Solid line
|
378
|
+
# * 2 : LINETYPE_DASHED - Dashed line
|
379
|
+
# * 3 : LINETYPE_DOTTED - Dotted line
|
380
|
+
# * 4 : LINETYPE_DASHED_DOTTED - Dashed-dotted line
|
381
|
+
# * -1 : LINETYPE_DASH_2_DOT - Sequence of one dash followed by two dots
|
382
|
+
# * -2 : LINETYPE_DASH_3_DOT - Sequence of one dash followed by three dots
|
383
|
+
# * -3 : LINETYPE_LONG_DASH - Sequence of long dashes
|
384
|
+
# * -4 : LINETYPE_LONG_SHORT_DASH - Sequence of a long dash followed by a short dash
|
385
|
+
# * -5 : LINETYPE_SPACED_DASH - Sequence of dashes double spaced
|
386
|
+
# * -6 : LINETYPE_SPACED_DOT - Sequence of dots double spaced
|
387
|
+
# * -7 : LINETYPE_DOUBLE_DOT - Sequence of pairs of dots
|
388
|
+
# * -8 : LINETYPE_TRIPLE_DOT - Sequence of groups of three dots
|
389
|
+
#
|
390
|
+
# @!method setlinetype
|
341
391
|
|
342
392
|
def inqlinetype
|
343
393
|
inquiry_int { |pt| super(pt) }
|
344
394
|
end
|
345
395
|
|
346
396
|
# Define the line width of subsequent polyline output primitives.
|
397
|
+
#
|
398
|
+
# The line width is calculated as the nominal line width generated on the
|
399
|
+
# workstation multiplied by the line width scale factor. This value is mapped
|
400
|
+
# by the workstation to the nearest available line width. The default line
|
401
|
+
# width is 1.0, or 1 times the line width generated on the graphics device.
|
402
|
+
#
|
347
403
|
# @param width [Numeric] The polyline line width scale factor
|
348
|
-
#
|
349
|
-
#
|
350
|
-
# This value is mapped by the workstation to the nearest available line width.
|
351
|
-
# The default line width is 1.0, or 1 times the line width generated on the graphics device.
|
352
|
-
def setlinewidth(*)
|
353
|
-
super
|
354
|
-
end
|
404
|
+
#
|
405
|
+
# @!method setlinewidth
|
355
406
|
|
356
407
|
def inqlinewidth
|
357
408
|
inquiry_double { |pt| super(pt) }
|
358
409
|
end
|
359
410
|
|
360
411
|
# Define the color of subsequent polyline output primitives.
|
412
|
+
#
|
361
413
|
# @param color [Integer] The polyline color index (COLOR < 1256)
|
362
|
-
|
363
|
-
|
364
|
-
end
|
414
|
+
#
|
415
|
+
# @!method setlinecolorind
|
365
416
|
|
366
|
-
# inqlinecolorind
|
367
417
|
def inqlinecolorind
|
368
418
|
inquiry_int { |pt| super(pt) }
|
369
419
|
end
|
370
420
|
|
371
421
|
# Specifiy the marker type for polymarkers.
|
422
|
+
#
|
372
423
|
# @param style [Integer] The polymarker marker type
|
373
|
-
# * 1 : MARKERTYPE_DOT
|
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
|
-
#
|
407
|
-
# * -
|
408
|
-
#
|
409
|
-
# * -
|
410
|
-
#
|
411
|
-
# * -15 : MARKERTYPE_SOLID_STAR
|
412
|
-
# * Filled Star
|
413
|
-
# * -16 : MARKERTYPE_TRI_UP_DOWN
|
414
|
-
# * Hollow triangles pointing up and down overlaid
|
415
|
-
# * -17 : MARKERTYPE_SOLID_TRI_RIGHT
|
416
|
-
# * Filled triangle point right
|
417
|
-
# * -18 : MARKERTYPE_SOLID_TRI_LEFT
|
418
|
-
# * Filled triangle pointing left
|
419
|
-
# * -19 : MARKERTYPE_HOLLOW PLUS
|
420
|
-
# * Hollow plus sign
|
421
|
-
# * -20 : MARKERTYPE_SOLID PLUS
|
422
|
-
# * Solid plus sign
|
423
|
-
# * -21 : MARKERTYPE_PENTAGON
|
424
|
-
# * Pentagon
|
425
|
-
# * -22 : MARKERTYPE_HEXAGON
|
426
|
-
# * Hexagon
|
427
|
-
# * -23 : MARKERTYPE_HEPTAGON
|
428
|
-
# * Heptagon
|
429
|
-
# * -24 : MARKERTYPE_OCTAGON
|
430
|
-
# * Octagon
|
431
|
-
# * -25 : MARKERTYPE_STAR_4
|
432
|
-
# * 4-pointed star
|
433
|
-
# * -26 : MARKERTYPE_STAR_5
|
434
|
-
# * 5-pointed star (pentagram)
|
435
|
-
# * -27 : MARKERTYPE_STAR_6
|
436
|
-
# * 6-pointed star (hexagram)
|
437
|
-
# * -28 : MARKERTYPE_STAR_7
|
438
|
-
# * 7-pointed star (heptagram)
|
439
|
-
# * -29 : MARKERTYPE_STAR_8
|
440
|
-
# * 8-pointed star (octagram)
|
441
|
-
# * -30 : MARKERTYPE_VLINE
|
442
|
-
# * verical line
|
443
|
-
# * -31 : MARKERTYPE_HLINE
|
444
|
-
# * horizontal line
|
445
|
-
# * -32 : MARKERTYPE_OMARK
|
446
|
-
# * o-mark
|
424
|
+
# * 1 : MARKERTYPE_DOT - Smallest displayable dot
|
425
|
+
# * 2 : MARKERTYPE_PLUS - Plus sign
|
426
|
+
# * 3 : MARKERTYPE_ASTERISK - Asterisk
|
427
|
+
# * 4 : MARKERTYPE_CIRCLE - Hollow circle
|
428
|
+
# * 5 : MARKERTYPE_DIAGONAL_CROSS - Diagonal cross
|
429
|
+
# * -1 : MARKERTYPE_SOLID_CIRCLE - Filled circle
|
430
|
+
# * -2 : MARKERTYPE_TRIANGLE_UP - Hollow triangle pointing upward
|
431
|
+
# * -3 : MARKERTYPE_SOLID_TRI_UP - Filled triangle pointing upward
|
432
|
+
# * -4 : MARKERTYPE_TRIANGLE_DOWN - Hollow triangle pointing downward
|
433
|
+
# * -5 : MARKERTYPE_SOLID_TRI_DOWN - Filled triangle pointing downward
|
434
|
+
# * -6 : MARKERTYPE_SQUARE - Hollow square
|
435
|
+
# * -7 : MARKERTYPE_SOLID_SQUARE - Filled square
|
436
|
+
# * -8 : MARKERTYPE_BOWTIE - Hollow bowtie
|
437
|
+
# * -9 : MARKERTYPE_SOLID_BOWTIE - Filled bowtie
|
438
|
+
# * -10 : MARKERTYPE_HGLASS - Hollow hourglass
|
439
|
+
# * -11 : MARKERTYPE_SOLID_HGLASS - Filled hourglass
|
440
|
+
# * -12 : MARKERTYPE_DIAMOND - Hollow diamond
|
441
|
+
# * -13 : MARKERTYPE_SOLID_DIAMOND - Filled Diamond
|
442
|
+
# * -14 : MARKERTYPE_STAR - Hollow star
|
443
|
+
# * -15 : MARKERTYPE_SOLID_STAR - Filled Star
|
444
|
+
# * -16 : MARKERTYPE_TRI_UP_DOWN - Hollow triangles pointing up and down overlaid
|
445
|
+
# * -17 : MARKERTYPE_SOLID_TRI_RIGHT - Filled triangle point right
|
446
|
+
# * -18 : MARKERTYPE_SOLID_TRI_LEFT - Filled triangle pointing left
|
447
|
+
# * -19 : MARKERTYPE_HOLLOW PLUS - Hollow plus sign
|
448
|
+
# * -20 : MARKERTYPE_SOLID PLUS - Solid plus sign
|
449
|
+
# * -21 : MARKERTYPE_PENTAGON - Pentagon
|
450
|
+
# * -22 : MARKERTYPE_HEXAGON - Hexagon
|
451
|
+
# * -23 : MARKERTYPE_HEPTAGON - Heptagon
|
452
|
+
# * -24 : MARKERTYPE_OCTAGON - Octagon
|
453
|
+
# * -25 : MARKERTYPE_STAR_4 - 4-pointed star
|
454
|
+
# * -26 : MARKERTYPE_STAR_5 - 5-pointed star (pentagram)
|
455
|
+
# * -27 : MARKERTYPE_STAR_6 - 6-pointed star (hexagram)
|
456
|
+
# * -28 : MARKERTYPE_STAR_7 - 7-pointed star (heptagram)
|
457
|
+
# * -29 : MARKERTYPE_STAR_8 - 8-pointed star (octagram)
|
458
|
+
# * -30 : MARKERTYPE_VLINE - verical line
|
459
|
+
# * -31 : MARKERTYPE_HLINE - horizontal line
|
460
|
+
# * -32 : MARKERTYPE_OMARK - o-mark
|
461
|
+
#
|
447
462
|
# Polymarkers appear centered over their specified coordinates.
|
448
|
-
|
449
|
-
|
450
|
-
end
|
463
|
+
#
|
464
|
+
# @!method setmarkertype
|
451
465
|
|
452
466
|
def inqmarkertype
|
453
467
|
inquiry_int { |pt| super(pt) }
|
454
468
|
end
|
455
469
|
|
456
470
|
# Specify the marker size for polymarkers.
|
471
|
+
#
|
472
|
+
# The polymarker size is calculated as the nominal size generated on the
|
473
|
+
# graphics device multiplied by the marker size scale factor.
|
474
|
+
#
|
457
475
|
# @param size [Numeric] Scale factor applied to the nominal marker size
|
458
|
-
#
|
459
|
-
#
|
460
|
-
def setmarkersize(*)
|
461
|
-
super
|
462
|
-
end
|
476
|
+
#
|
477
|
+
# @!method setmarkersize
|
463
478
|
|
464
479
|
# Inquire the marker size for polymarkers.
|
480
|
+
#
|
481
|
+
# @return [Numeric] Scale factor applied to the nominal marker size
|
482
|
+
#
|
465
483
|
def inqmarkersize
|
466
484
|
inquiry_double { |pt| super(pt) }
|
467
485
|
end
|
468
486
|
|
469
487
|
# Define the color of subsequent polymarker output primitives.
|
488
|
+
#
|
470
489
|
# @param color [Integer] The polymarker color index (COLOR < 1256)
|
471
|
-
|
472
|
-
|
473
|
-
end
|
490
|
+
#
|
491
|
+
# @!method setmarkercolorind
|
474
492
|
|
475
493
|
def inqmarkercolorind
|
476
494
|
inquiry_int { |pt| super(pt) }
|
477
495
|
end
|
478
496
|
|
479
497
|
# Specify the text font and precision for subsequent text output primitives.
|
498
|
+
#
|
480
499
|
# @param font [Integer] Text font
|
481
500
|
# * 101 : FONT_TIMES_ROMAN
|
482
501
|
# * 102 : FONT_TIMES_ITALIC
|
@@ -509,185 +528,217 @@ module GR
|
|
509
528
|
# * 129 : FONT_PALATINO_BOLDITALIC
|
510
529
|
# * 130 : FONT_ZAPFCHANCERY_MEDIUMITALIC
|
511
530
|
# * 131 : FONT_ZAPFDINGBATS
|
531
|
+
# * 232 : FONT_COMPUTERMODERN
|
532
|
+
# * 233 : FONT_DEJAVUSANS
|
533
|
+
#
|
512
534
|
# @param precision [Integer] Text precision
|
513
|
-
# * 0 : TEXT_PRECISION_STRING
|
514
|
-
#
|
515
|
-
# *
|
516
|
-
#
|
517
|
-
#
|
518
|
-
# * Stroke precision (lower quality)
|
535
|
+
# * 0 : TEXT_PRECISION_STRING - String precision (higher quality)
|
536
|
+
# * 1 : TEXT_PRECISION_CHAR - Character precision (medium quality)
|
537
|
+
# * 2 : TEXT_PRECISION_STROKE - Stroke precision (lower quality)
|
538
|
+
# * 3 : TEXT_PRECISION_OUTLINE - Outline precision (highest quality)
|
539
|
+
#
|
519
540
|
# The appearance of a font depends on the text precision value specified.
|
520
541
|
# STRING, CHARACTER or STROKE precision allows for a greater or lesser
|
521
542
|
# realization of the text primitives, for efficiency. STRING is the default
|
522
|
-
# precision for GR and produces the highest quality output
|
523
|
-
|
524
|
-
|
525
|
-
|
543
|
+
# precision for GR and produces the highest quality output using either
|
544
|
+
# native font rendering or FreeType. OUTLINE uses the GR path rendering
|
545
|
+
# functions to draw individual glyphs and produces the highest quality output.
|
546
|
+
#
|
547
|
+
# @!method settextfontprec
|
526
548
|
|
527
549
|
# Set the current character expansion factor (width to height ratio).
|
528
|
-
#
|
529
|
-
# `setcharexpan` defines the width of subsequent text output primitives.
|
530
|
-
# factor alters the width of the generated characters, but not
|
531
|
-
# text expansion factor is 1, or one times the
|
532
|
-
|
533
|
-
|
534
|
-
|
550
|
+
#
|
551
|
+
# `setcharexpan` defines the width of subsequent text output primitives.
|
552
|
+
# The expansion factor alters the width of the generated characters, but not
|
553
|
+
# their height. The default text expansion factor is 1, or one times the
|
554
|
+
# normal width-to-height ratio of the text.
|
555
|
+
#
|
556
|
+
# @param factor [Numeric] Text expansion factor applied to the nominal text
|
557
|
+
# width-to-height ratio
|
558
|
+
#
|
559
|
+
# @!method setcharexpan
|
535
560
|
|
536
|
-
|
537
|
-
super
|
538
|
-
end
|
561
|
+
# @!method setcharspace
|
539
562
|
|
540
563
|
# Sets the current text color index.
|
541
|
-
#
|
564
|
+
#
|
542
565
|
# `settextcolorind` defines the color of subsequent text output primitives.
|
543
|
-
# GR uses the default foreground color (black=1) for the default text color
|
544
|
-
|
545
|
-
|
546
|
-
|
566
|
+
# GR uses the default foreground color (black=1) for the default text color
|
567
|
+
# index.
|
568
|
+
#
|
569
|
+
# @param color [Integer] The text color index (COLOR < 1256)
|
570
|
+
#
|
571
|
+
# @!method settextcolorind
|
547
572
|
|
548
573
|
# Gets the current text color index.
|
574
|
+
#
|
549
575
|
# This function gets the color of text output primitives.
|
576
|
+
#
|
550
577
|
# @return [Integer] color The text color index (COLOR < 1256)
|
551
578
|
def inqtextcolorind
|
552
579
|
inquiry_int { |pt| super(pt) }
|
553
580
|
end
|
554
581
|
|
555
582
|
# Set the current character height.
|
583
|
+
#
|
584
|
+
# `setcharheight` defines the height of subsequent text output primitives.
|
585
|
+
# Text height is defined as a percentage of the default window. GR uses the
|
586
|
+
# default text height of 0.027 (2.7% of the height of the default window).
|
587
|
+
#
|
556
588
|
# @param height [Numeric] Text height value
|
557
|
-
#
|
558
|
-
#
|
559
|
-
|
560
|
-
|
561
|
-
|
589
|
+
#
|
590
|
+
# @!method setcharheight
|
591
|
+
|
592
|
+
# Gets the current character height.
|
593
|
+
#
|
594
|
+
# This function gets the height of text output primitives. Text height is
|
595
|
+
# defined as a percentage of the default window. GR uses the default text
|
596
|
+
# height of 0.027 (2.7% of the height of the default window).
|
597
|
+
#
|
598
|
+
# @return [Numeric] Text height value
|
599
|
+
def inqcharheight
|
600
|
+
inquiry_double { |pt| super(pt) }
|
562
601
|
end
|
563
602
|
|
564
603
|
# Set the current character text angle up vector.
|
565
|
-
#
|
566
|
-
#
|
567
|
-
#
|
568
|
-
#
|
569
|
-
|
570
|
-
|
571
|
-
|
604
|
+
#
|
605
|
+
# `setcharup` defines the vertical rotation of subsequent text output
|
606
|
+
# primitives. The text up vector is initially set to (0, 1), horizontal to
|
607
|
+
# the baseline.
|
608
|
+
#
|
609
|
+
# @param ux [Numeric] X coordinate of the text up vector
|
610
|
+
# @param uy [Numeric] Y coordinate of the text up vector
|
611
|
+
#
|
612
|
+
# @!method setcharup
|
572
613
|
|
573
614
|
# Define the current direction in which subsequent text will be drawn.
|
615
|
+
#
|
574
616
|
# @param path [Integer] Text path
|
575
|
-
# * 0 : TEXT_PATH_RIGHT
|
576
|
-
#
|
577
|
-
# *
|
578
|
-
#
|
579
|
-
#
|
580
|
-
#
|
581
|
-
# * 3 : TEXT_PATH_DOWN
|
582
|
-
# * upside-down
|
583
|
-
def settextpath(*)
|
584
|
-
super
|
585
|
-
end
|
617
|
+
# * 0 : TEXT_PATH_RIGHT - left-to-right
|
618
|
+
# * 1 : TEXT_PATH_LEFT - right-to-left
|
619
|
+
# * 2 : TEXT_PATH_UP - downside-up
|
620
|
+
# * 3 : TEXT_PATH_DOWN - upside-down
|
621
|
+
#
|
622
|
+
# @!method settextpath
|
586
623
|
|
587
624
|
# Set the current horizontal and vertical alignment for text.
|
625
|
+
#
|
588
626
|
# @param horizontal [Integer] Horizontal text alignment
|
589
|
-
# * 0 :
|
590
|
-
|
591
|
-
#
|
592
|
-
# * 2 : TEXT_HALIGN_CENTER
|
593
|
-
#
|
594
|
-
#
|
595
|
-
# * Right justify
|
627
|
+
# * 0 : TEXT_HALIGN_NORMALlygon using the fill color index
|
628
|
+
|
629
|
+
# * 1 : TEXT_HALIGN_LEFT - Left justify
|
630
|
+
# * 2 : TEXT_HALIGN_CENTER - Center justify
|
631
|
+
# * 3 : TEXT_HALIGN_RIGHT - Right justify
|
632
|
+
#
|
596
633
|
# @param vertical [Integer] Vertical text alignment
|
597
634
|
# * 0 : TEXT_VALIGN_NORMAL
|
598
|
-
# * 1 : TEXT_VALIGN_TOP
|
599
|
-
#
|
600
|
-
# *
|
601
|
-
#
|
602
|
-
# *
|
603
|
-
#
|
604
|
-
#
|
605
|
-
#
|
606
|
-
#
|
607
|
-
#
|
608
|
-
#
|
609
|
-
# in horizontal and vertical space. The default text alignment indicates horizontal left
|
610
|
-
# alignment and vertical baseline alignment.
|
611
|
-
def settextalign(*)
|
612
|
-
super
|
613
|
-
end
|
635
|
+
# * 1 : TEXT_VALIGN_TOP - Align with the top of the characters
|
636
|
+
# * 2 : TEXT_VALIGN_CAP - Aligned with the cap of the characters
|
637
|
+
# * 3 : TEXT_VALIGN_HALF - Aligned with the half line of the characters
|
638
|
+
# * 4 : TEXT_VALIGN_BASE - Aligned with the base line of the characters
|
639
|
+
# * 5 : TEXT_VALIGN_BOTTOM - Aligned with the bottom line of the characters
|
640
|
+
#
|
641
|
+
# `settextalign` specifies how the characters in a text primitive will be
|
642
|
+
# aligned in horizontal and vertical space. The default text alignment
|
643
|
+
# indicates horizontal left alignment and vertical baseline alignment.
|
644
|
+
#
|
645
|
+
# @!method settextalign
|
614
646
|
|
615
647
|
# Set the fill area interior style to be used for fill areas.
|
648
|
+
#
|
616
649
|
# @param style [Integer] The style of fill to be used
|
617
|
-
# * 0 : HOLLOW
|
618
|
-
#
|
619
|
-
# *
|
620
|
-
#
|
621
|
-
# *
|
622
|
-
#
|
623
|
-
# * 3 : HATCH
|
624
|
-
# * Fill the interior of the polygon using the style index as a cross-hatched style
|
650
|
+
# * 0 : HOLLOW - No filling. Just draw the bounding polyline
|
651
|
+
# * 1 : SOLID - Fill the interior of the polygon using the fill color index
|
652
|
+
# * 2 : PATTERN - Fill the interior of the polygon using the style index as a pattern index
|
653
|
+
# * 3 : HATCH - Fill the interior of the polygon using the style index as a cross-hatched style
|
654
|
+
# * 4 : SOLID_WITH_BORDER - Fill the interior of the polygon using the fill color index and draw the bounding polyline
|
655
|
+
#
|
625
656
|
# `setfillintstyle` defines the interior style for subsequent fill area output
|
626
657
|
# primitives. The default interior style is HOLLOW.
|
627
|
-
|
628
|
-
|
629
|
-
end
|
658
|
+
#
|
659
|
+
# @!method setfillintstyle
|
630
660
|
|
631
661
|
# Returns the fill area interior style to be used for fill areas.
|
662
|
+
#
|
663
|
+
# This function gets the currently set fill style.
|
664
|
+
#
|
665
|
+
# @return [Integer] The currently set fill style
|
632
666
|
def inqfillintstyle
|
633
667
|
inquiry_int { |pt| super(pt) }
|
634
668
|
end
|
635
669
|
|
636
670
|
# Sets the fill style to be used for subsequent fill areas.
|
671
|
+
#
|
672
|
+
# `setfillstyle` specifies an index when PATTERN fill or HATCH fill is
|
673
|
+
# requested by the`setfillintstyle` function. If the interior style is set
|
674
|
+
# to PATTERN, the fill style index points to a device-independent pattern
|
675
|
+
# table. If interior style is set to HATCH the fill style index indicates
|
676
|
+
# different hatch styles. If HOLLOW or SOLID is specified for the interior
|
677
|
+
# style, the fill style index is unused.
|
678
|
+
#
|
637
679
|
# @param index [Integer] The fill style index to be used
|
638
|
-
#
|
639
|
-
#
|
640
|
-
# index points to a device-independent pattern table. If interior style is set to HATCH
|
641
|
-
# the fill style index indicates different hatch styles. If HOLLOW or SOLID is specified
|
642
|
-
# for the interior style, the fill style index is unused.
|
643
|
-
def setfillstyle(*)
|
644
|
-
super
|
645
|
-
end
|
680
|
+
#
|
681
|
+
# @!method setfillstyle
|
646
682
|
|
647
683
|
# Returns the current fill area color index.
|
684
|
+
#
|
685
|
+
# This function gets the color index for PATTERN and HATCH fills.
|
686
|
+
#
|
687
|
+
# @return [Integer] The currently set fill style color index
|
648
688
|
def inqfillstyle
|
649
689
|
inquiry_int { |pt| super(pt) }
|
650
690
|
end
|
651
691
|
|
652
692
|
# Sets the current fill area color index.
|
693
|
+
#
|
694
|
+
# `setfillcolorind` defines the color of subsequent fill area output
|
695
|
+
# primitives. GR uses the default foreground color (black=1) for the default
|
696
|
+
# fill area color index.
|
697
|
+
#
|
653
698
|
# @param color [Integer] The text color index (COLOR < 1256)
|
654
|
-
#
|
655
|
-
#
|
656
|
-
def setfillcolorind(*)
|
657
|
-
super
|
658
|
-
end
|
699
|
+
#
|
700
|
+
# @!method setfillcolorind
|
659
701
|
|
660
702
|
# Returns the current fill area color index.
|
703
|
+
#
|
704
|
+
# This function gets the color of fill area output primitives.
|
705
|
+
#
|
706
|
+
# @return [Integer] The text color index (COLOR < 1256)
|
661
707
|
def inqfillcolorind
|
662
708
|
inquiry_int { |pt| super(pt) }
|
663
709
|
end
|
664
710
|
|
665
|
-
#
|
666
|
-
#
|
711
|
+
# Redefine an existing color index representation by specifying an RGB color
|
712
|
+
# triplet.
|
713
|
+
#
|
667
714
|
# @param index [Integer] Color index in the range 0 to 1256
|
668
|
-
# @param red
|
715
|
+
# @param red [Numeric] Red intensity in the range 0.0 to 1.0
|
669
716
|
# @param green [Numeric] Green intensity in the range 0.0 to 1.0
|
670
|
-
# @param blue
|
671
|
-
|
672
|
-
|
673
|
-
end
|
717
|
+
# @param blue [Numeric] Blue intensity in the range 0.0 to 1.0
|
718
|
+
#
|
719
|
+
# @!method setcolorrep
|
674
720
|
|
675
|
-
# `setwindow` establishes a window, or rectangular subspace, of world
|
676
|
-
# plotted. If you desire log scaling or mirror-imaging of
|
677
|
-
#
|
721
|
+
# `setwindow` establishes a window, or rectangular subspace, of world
|
722
|
+
# coordinates to be plotted. If you desire log scaling or mirror-imaging of
|
723
|
+
# axes, use the SETSCALE function.
|
724
|
+
#
|
725
|
+
# `setwindow` defines the rectangular portion of the World Coordinate space
|
726
|
+
# (WC) to be associated with the specified normalization transformation. The
|
727
|
+
# WC window and the Normalized Device Coordinates (NDC) viewport define the
|
728
|
+
# normalization transformation through which all output primitives are
|
729
|
+
# mapped. The WC window is mapped onto the rectangular NDC viewport which is,
|
730
|
+
# in turn, mapped onto the display surface of the open and active workstation,
|
731
|
+
# in device coordinates. By default, GR uses the range [0,1] x [0,1], in
|
732
|
+
# world coordinates, as the normalization transformation window.
|
733
|
+
#
|
734
|
+
# @param xmin [Numeric] The left horizontal coordinate of the window
|
735
|
+
# (`xmin` < `xmax`).
|
678
736
|
# @param xmax [Numeric] The right horizontal coordinate of the window.
|
679
|
-
# @param ymin [Numeric] The bottom vertical coordinate of the window
|
737
|
+
# @param ymin [Numeric] The bottom vertical coordinate of the window
|
738
|
+
# (`ymin` < `ymax`).
|
680
739
|
# @param ymax [Numeric] The top vertical coordinate of the window.
|
681
|
-
#
|
682
|
-
#
|
683
|
-
# Normalized Device Coordinates (NDC) viewport define the normalization transformation
|
684
|
-
# through which all output primitives are mapped. The WC window is mapped onto the
|
685
|
-
# rectangular NDC viewport which is, in turn, mapped onto the display surface of the
|
686
|
-
# open and active workstation, in device coordinates. By default, GR uses the range
|
687
|
-
# \[0,1] x [0,1], in world coordinates, as the normalization transformation window.
|
688
|
-
def setwindow(*)
|
689
|
-
super
|
690
|
-
end
|
740
|
+
#
|
741
|
+
# @!method setwindow
|
691
742
|
|
692
743
|
# inqwindow
|
693
744
|
def inqwindow
|
@@ -696,20 +747,25 @@ module GR
|
|
696
747
|
end
|
697
748
|
end
|
698
749
|
|
699
|
-
# `setviewport` establishes a rectangular subspace of normalized device
|
750
|
+
# `setviewport` establishes a rectangular subspace of normalized device
|
751
|
+
# coordinates.
|
752
|
+
#
|
753
|
+
# `setviewport` defines the rectangular portion of the Normalized Device
|
754
|
+
# Coordinate (NDC) space to be associated with the specified normalization
|
755
|
+
# transformation. The NDC viewport and World Coordinate (WC) window define
|
756
|
+
# the normalization transformation through which all output primitives pass.
|
757
|
+
# The WC window is mapped onto the rectangular NDC viewport which is, in
|
758
|
+
# turn, mapped onto the display surface of the open and active workstation,
|
759
|
+
# in device coordinates.
|
760
|
+
#
|
700
761
|
# @param xmin [Numeric] The left horizontal coordinate of the viewport.
|
701
|
-
# @param xmax [Numeric] The right horizontal coordinate of the viewport
|
762
|
+
# @param xmax [Numeric] The right horizontal coordinate of the viewport
|
763
|
+
# (0 <= `xmin` < `xmax` <= 1).
|
702
764
|
# @param ymin [Numeric] The bottom vertical coordinate of the viewport.
|
703
|
-
# @param ymax [Numeric] The top vertical coordinate of the viewport
|
704
|
-
# `
|
705
|
-
#
|
706
|
-
#
|
707
|
-
# through which all output primitives pass. The WC window is mapped onto the rectangular
|
708
|
-
# NDC viewport which is, in turn, mapped onto the display surface of the open and active
|
709
|
-
# workstation, in device coordinates.
|
710
|
-
def setviewport(*)
|
711
|
-
super
|
712
|
-
end
|
765
|
+
# @param ymax [Numeric] The top vertical coordinate of the viewport
|
766
|
+
# (0 <= `ymin` < `ymax` <= 1).
|
767
|
+
#
|
768
|
+
# @!method setviewport
|
713
769
|
|
714
770
|
# inqviewport
|
715
771
|
def inqviewport
|
@@ -718,99 +774,103 @@ module GR
|
|
718
774
|
end
|
719
775
|
end
|
720
776
|
|
721
|
-
# `selntran` selects a predefined transformation from world coordinates to
|
722
|
-
# device coordinates.
|
777
|
+
# `selntran` selects a predefined transformation from world coordinates to
|
778
|
+
# normalized device coordinates.
|
779
|
+
#
|
723
780
|
# @param transform [Integer] A normalization transformation number.
|
724
|
-
# * 0 : Selects the identity transformation in which both the window and
|
725
|
-
#
|
726
|
-
|
727
|
-
|
728
|
-
|
781
|
+
# * 0 : Selects the identity transformation in which both the window and
|
782
|
+
# viewport have the range of 0 to 1
|
783
|
+
# * >= 1 : Selects a normalization transformation as defined by `setwindow`
|
784
|
+
# and `setviewport`
|
785
|
+
#
|
786
|
+
# @!method selntran
|
729
787
|
|
730
788
|
# Set the clipping indicator.
|
731
|
-
#
|
789
|
+
#
|
790
|
+
# @param indicator [Integer] An indicator specifying whether clipping is on
|
791
|
+
# or off.
|
732
792
|
# * 0 : Clipping is off. Data outside of the window will be drawn.
|
733
793
|
# * 1 : Clipping is on. Data outside of the window will not be drawn.
|
734
|
-
#
|
735
|
-
#
|
736
|
-
#
|
737
|
-
#
|
738
|
-
#
|
739
|
-
#
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
# Set the area of the NDC viewport that is to be drawn in the workstation
|
745
|
-
#
|
746
|
-
#
|
747
|
-
#
|
748
|
-
#
|
749
|
-
#
|
750
|
-
#
|
751
|
-
#
|
752
|
-
#
|
753
|
-
|
754
|
-
|
755
|
-
|
794
|
+
#
|
795
|
+
# `setclip` enables or disables clipping of the image drawn in the current
|
796
|
+
# window. Clipping is defined as the removal of those portions of the graph
|
797
|
+
# that lie outside of the defined viewport. If clipping is on, GR does not
|
798
|
+
# draw generated output primitives past the viewport boundaries. If clipping
|
799
|
+
# is off, primitives may exceed the viewport boundaries, and they will be
|
800
|
+
# drawn to the edge of the workstation window. By default, clipping is on.
|
801
|
+
#
|
802
|
+
# @!method setclip
|
803
|
+
|
804
|
+
# Set the area of the NDC viewport that is to be drawn in the workstation
|
805
|
+
# window.
|
806
|
+
#
|
807
|
+
# `setwswindow` defines the rectangular area of the Normalized Device
|
808
|
+
# Coordinate space to be output to the device. By default, the workstation
|
809
|
+
# transformation will map the range [0,1] x [0,1] in NDC onto the largest
|
810
|
+
# square on the workstation’s display surface. The aspect ratio of the
|
811
|
+
# workstation window is maintained at 1 to 1.
|
812
|
+
#
|
813
|
+
# @param xmin [Numeric] The left horizontal coordinate of the workstation
|
814
|
+
# window.
|
815
|
+
# @param xmax [Numeric] The right horizontal coordinate of the workstation
|
816
|
+
# window (0 <= `xmin` < `xmax` <= 1).
|
817
|
+
# @param ymin [Numeric] The bottom vertical coordinate of the workstation
|
818
|
+
# window.
|
819
|
+
# @param ymax [Numeric] The top vertical coordinate of the workstation
|
820
|
+
# window (0 <= `ymin` < `ymax` <= 1).
|
821
|
+
#
|
822
|
+
# @!method setwswindow
|
756
823
|
|
757
824
|
# Define the size of the workstation graphics window in meters.
|
758
|
-
#
|
759
|
-
#
|
760
|
-
#
|
761
|
-
#
|
762
|
-
#
|
763
|
-
#
|
764
|
-
#
|
765
|
-
#
|
766
|
-
|
767
|
-
|
768
|
-
|
825
|
+
#
|
826
|
+
# `setwsviewport` places a workstation window on the display of the
|
827
|
+
# specified size in meters. This command allows the workstation window to be
|
828
|
+
# accurately sized for a display or hardcopy device, and is often useful for
|
829
|
+
# sizing graphs for desktop publishing applications.
|
830
|
+
#
|
831
|
+
# @param xmin [Numeric] The left horizontal coordinate of the workstation
|
832
|
+
# viewport.
|
833
|
+
# @param xmax [Numeric] The right horizontal coordinate of the workstation
|
834
|
+
# viewport.
|
835
|
+
# @param ymin [Numeric] The bottom vertical coordinate of the workstation
|
836
|
+
# viewport.
|
837
|
+
# @param ymax [Numeric] The top vertical coordinate of the workstation
|
838
|
+
# viewport.
|
839
|
+
#
|
840
|
+
# @!method setwsviewport
|
769
841
|
|
770
|
-
|
771
|
-
super
|
772
|
-
end
|
842
|
+
# @!method createseg
|
773
843
|
|
774
|
-
|
775
|
-
super
|
776
|
-
end
|
844
|
+
# @!method copysegws
|
777
845
|
|
778
|
-
|
779
|
-
super
|
780
|
-
end
|
846
|
+
# @!method redrawsegws
|
781
847
|
|
782
|
-
|
783
|
-
super
|
784
|
-
end
|
848
|
+
# @!method setsegtran
|
785
849
|
|
786
|
-
|
787
|
-
super
|
788
|
-
end
|
850
|
+
# @!method closeseg
|
789
851
|
|
790
|
-
|
791
|
-
super
|
792
|
-
end
|
852
|
+
# @!method emergencyclosegks
|
793
853
|
|
794
|
-
|
795
|
-
super
|
796
|
-
end
|
854
|
+
# @!method updategks
|
797
855
|
|
798
|
-
# Set the abstract Z-space used for mapping three-dimensional output
|
799
|
-
# the current world coordinate space.
|
800
|
-
#
|
801
|
-
#
|
856
|
+
# Set the abstract Z-space used for mapping three-dimensional output
|
857
|
+
# primitives into the current world coordinate space.
|
858
|
+
#
|
859
|
+
# `setspace` establishes the limits of an abstract Z-axis and defines the
|
860
|
+
# angles for rotation and for the viewing angle (tilt) of a simulated
|
861
|
+
# three-dimensional graph, used for mapping corresponding output primitives
|
862
|
+
# into the current window. These settings are used for all subsequent
|
863
|
+
# three-dimensional output primitives until other values are specified.
|
864
|
+
# Angles of rotation and viewing angle must be specified between 0° and 90°.
|
865
|
+
#
|
866
|
+
# @param zmin [Numeric] Minimum value for the Z-axis.
|
867
|
+
# @param zmax [Numeric] Maximum value for the Z-axis.
|
802
868
|
# @param rotation [Integer] Angle for the rotation of the X axis, in degrees.
|
803
|
-
# @param tilt
|
804
|
-
#
|
805
|
-
#
|
806
|
-
#
|
807
|
-
#
|
808
|
-
# These settings are used for all subsequent three-dimensional output primitives until
|
809
|
-
# other values are specified. Angles of rotation and viewing angle must be specified
|
810
|
-
# between 0° and 90°.
|
811
|
-
def setspace(*)
|
812
|
-
super
|
813
|
-
end
|
869
|
+
# @param tilt [integer] Viewing angle of the Z axis in degrees.
|
870
|
+
#
|
871
|
+
# @return [Integer]
|
872
|
+
#
|
873
|
+
# @!method setspace
|
814
874
|
|
815
875
|
def inqspace
|
816
876
|
inquiry %i[double double int int] do |*pts|
|
@@ -818,64 +878,63 @@ module GR
|
|
818
878
|
end
|
819
879
|
end
|
820
880
|
|
821
|
-
# `setscale` sets the type of transformation to be used for subsequent GR
|
822
|
-
# primitives.
|
881
|
+
# `setscale` sets the type of transformation to be used for subsequent GR
|
882
|
+
# output primitives.
|
883
|
+
#
|
823
884
|
# @param options [Integer] Scale specification
|
824
|
-
# * 1 : OPTION_X_LOG
|
825
|
-
#
|
826
|
-
# *
|
827
|
-
#
|
828
|
-
# *
|
829
|
-
#
|
830
|
-
#
|
831
|
-
# * Flip X-axis
|
832
|
-
# * 16 : OPTION_FLIP_Y
|
833
|
-
# * Flip Y-axis
|
834
|
-
# * 32 : OPTION_FLIP_Z
|
835
|
-
# * Flip Z-axis
|
885
|
+
# * 1 : OPTION_X_LOG - Logarithmic X-axis
|
886
|
+
# * 2 : OPTION_Y_LOG - Logarithmic Y-axis
|
887
|
+
# * 4 : OPTION_Z_LOG - Logarithmic Z-axis
|
888
|
+
# * 8 : OPTION_FLIP_X - Flip X-axis
|
889
|
+
# * 16 : OPTION_FLIP_Y - Flip Y-axis
|
890
|
+
# * 32 : OPTION_FLIP_Z - Flip Z-axis
|
891
|
+
#
|
836
892
|
# @return [Integer]
|
893
|
+
#
|
837
894
|
# `setscale` defines the current transformation according to the given scale
|
838
|
-
# specification which may be or'ed together using any of the above options.
|
839
|
-
# these options for all subsequent output primitives until another
|
840
|
-
# The scale options are used to transform points from an
|
841
|
-
# semi-logarithmic coordinate system, which may be
|
842
|
-
# world coordinate system.
|
843
|
-
#
|
844
|
-
#
|
845
|
-
|
846
|
-
|
847
|
-
|
895
|
+
# specification which may be or'ed together using any of the above options.
|
896
|
+
# GR uses these options for all subsequent output primitives until another
|
897
|
+
# value is provided. The scale options are used to transform points from an
|
898
|
+
# abstract logarithmic or semi-logarithmic coordinate system, which may be
|
899
|
+
# flipped along each axis, into the world coordinate system.
|
900
|
+
#
|
901
|
+
# Note: When applying a logarithmic transformation to a specific axis, the
|
902
|
+
# system assumes that the axes limits are greater than zero.
|
903
|
+
#
|
904
|
+
# @!method setscale
|
848
905
|
|
849
906
|
# inqscale
|
850
907
|
def inqscale
|
851
908
|
inquiry_int { |pt| super(pt) }
|
852
909
|
end
|
853
910
|
|
854
|
-
# Draw a text at position `x`, `y` using the current text attributes.
|
855
|
-
# defined to create basic mathematical expressions and Greek
|
911
|
+
# Draw a text at position `x`, `y` using the current text attributes.
|
912
|
+
# Strings can be defined to create basic mathematical expressions and Greek
|
913
|
+
# letters.
|
914
|
+
#
|
915
|
+
# The values for X and Y are in normalized device coordinates.
|
916
|
+
# The attributes that control the appearance of text are text font and
|
917
|
+
# precision, character expansion factor, character spacing, text color index,
|
918
|
+
# character height, character up vector, text path and text alignment.
|
919
|
+
#
|
856
920
|
# @param x [Numeric] The X coordinate of starting position of the text string
|
857
921
|
# @param y [Numeric] The Y coordinate of starting position of the text string
|
858
|
-
# @param string [String]
|
922
|
+
# @param string [String] The text to be drawn
|
859
923
|
# @return [Integer]
|
860
924
|
#
|
861
|
-
# The values for X and Y are in normalized device coordinates.
|
862
|
-
# The attributes that control the appearance of text are text font and precision,
|
863
|
-
# character expansion factor, character spacing, text color index, character
|
864
|
-
# height, character up vector, text path and text alignment.
|
865
|
-
#
|
866
925
|
# The character string is interpreted to be a simple mathematical formula.
|
867
926
|
# The following notations apply:
|
868
927
|
#
|
869
|
-
# Subscripts and superscripts: These are indicated by carets ('^') and
|
870
|
-
# \('_'). If the sub/superscript contains more than one character,
|
871
|
-
# in curly braces ('{}').
|
928
|
+
# Subscripts and superscripts: These are indicated by carets ('^') and
|
929
|
+
# underscores \('_'). If the sub/superscript contains more than one character,
|
930
|
+
# it must be enclosed in curly braces ('{}').
|
872
931
|
#
|
873
|
-
# Fractions are typeset with A '/' B, where A stands for the numerator and B
|
874
|
-
# denominator.
|
932
|
+
# Fractions are typeset with A '/' B, where A stands for the numerator and B
|
933
|
+
# for the denominator.
|
875
934
|
#
|
876
935
|
# To include a Greek letter you must specify the corresponding keyword after a
|
877
|
-
# backslash ('\') character. The text translator produces uppercase or
|
878
|
-
# Greek letters depending on the case of the keyword.
|
936
|
+
# backslash ('\') character. The text translator produces uppercase or
|
937
|
+
# lowercase Greek letters depending on the case of the keyword.
|
879
938
|
# * Α α - alpha
|
880
939
|
# * Β β - beta
|
881
940
|
# * Γ γ - gamma
|
@@ -901,11 +960,10 @@ module GR
|
|
901
960
|
# * Ψ ψ - psi
|
902
961
|
# * Ω ω - omega
|
903
962
|
# Note: `\v` is a replacement for `\nu` which would conflict with `\n` (newline)
|
904
|
-
# For more sophisticated mathematical formulas, you should use the `
|
963
|
+
# For more sophisticated mathematical formulas, you should use the `mathtex`
|
905
964
|
# function.
|
906
|
-
|
907
|
-
|
908
|
-
end
|
965
|
+
#
|
966
|
+
# @!method textext
|
909
967
|
|
910
968
|
# inqtextext
|
911
969
|
def inqtextext(x, y, string)
|
@@ -914,11 +972,17 @@ module GR
|
|
914
972
|
end
|
915
973
|
end
|
916
974
|
|
917
|
-
# Draw X and Y coordinate axes with linearly and/or logarithmically spaced
|
918
|
-
#
|
919
|
-
#
|
920
|
-
# @param
|
921
|
-
#
|
975
|
+
# Draw X and Y coordinate axes with linearly and/or logarithmically spaced
|
976
|
+
# tick marks.
|
977
|
+
#
|
978
|
+
# @param x_tick [Numeric]
|
979
|
+
# The interval between minor tick marks on the X axis.
|
980
|
+
# @param y_tick [Numeric]
|
981
|
+
# The interval between minor tick marks on the Y axis.
|
982
|
+
# @param x_org [Numeric]
|
983
|
+
# The world coordinates of the origin (point of intersection) of the X axis.
|
984
|
+
# @param y_org [Numeric]
|
985
|
+
# The world coordinates of the origin (point of intersection) of the Y axis.
|
922
986
|
# @param major_x [Integer]
|
923
987
|
# Unitless integer values specifying the number of minor tick intervals
|
924
988
|
# between major tick marks. Values of 0 or 1 imply no minor ticks.
|
@@ -932,74 +996,142 @@ module GR
|
|
932
996
|
# coordinate unit. Major tick marks are twice as long as minor tick marks.
|
933
997
|
# A negative value reverses the tick marks on the axes from inward facing
|
934
998
|
# to outward facing (or vice versa).
|
935
|
-
|
936
|
-
|
937
|
-
|
999
|
+
#
|
1000
|
+
# Tick marks are positioned along each axis so that major tick marks fall on
|
1001
|
+
# the axes origin (whether visible or not). Major tick marks are labeled
|
1002
|
+
# with the corresponding data values. Axes are drawn according to the scale
|
1003
|
+
# of the window. Axes and tick marks are drawn using solid lines; line color
|
1004
|
+
# and width can be modified using the gr_setlinetype and gr_setlinewidth
|
1005
|
+
# functions. Axes are drawn according to the linear or logarithmic
|
1006
|
+
# transformation established by the gr_setscale function.
|
1007
|
+
#
|
1008
|
+
# @!method axes
|
938
1009
|
|
939
1010
|
alias axes2d axes
|
940
1011
|
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
#
|
946
|
-
#
|
947
|
-
#
|
948
|
-
#
|
949
|
-
#
|
1012
|
+
# Create axes in the current workspace and supply a custom function for
|
1013
|
+
# changing the behaviour of the tick labels.
|
1014
|
+
#
|
1015
|
+
# @note This method uses GRCommons::Fiddley::Function as a callback function.
|
1016
|
+
# Please read the source code If you have to use it. There are some
|
1017
|
+
# examples of the use of this function in the Plot class..
|
1018
|
+
#
|
1019
|
+
# Similar to gr_axes() but allows more fine-grained control over tick labels
|
1020
|
+
# and text positioning by supplying callback functions. Within the callback
|
1021
|
+
# function you can use normal GR text primitives for performing any
|
1022
|
+
# manipulations on the label text.
|
1023
|
+
# See gr_axes() for more details on drawing axes.
|
1024
|
+
#
|
1025
|
+
# @param x_tick [Numeric]
|
1026
|
+
# The interval between minor tick marks on the X axis.
|
1027
|
+
# @param y_tick [Numeric]
|
1028
|
+
# The interval between minor tick marks on the Y axis.
|
1029
|
+
# @param x_org [Numeric]
|
1030
|
+
# The world coordinate of the origin (point of intersection) of the X axis.
|
1031
|
+
# @param y_org [Numeric]
|
1032
|
+
# The world coordinate of the origin (point of intersection) of the Y axis.
|
950
1033
|
# @param major_x [Integer]
|
951
|
-
# Unitless integer
|
952
|
-
# between major
|
1034
|
+
# Unitless integer value specifying the number of minor tick intervals
|
1035
|
+
# between major tick marks on the X axis. Values of 0 or 1 imply no minor
|
1036
|
+
# ticks. Negative values specify no labels will be drawn for the associated
|
1037
|
+
# axis.
|
953
1038
|
# @param major_y [Integer]
|
954
|
-
# Unitless integer
|
955
|
-
# between major
|
1039
|
+
# Unitless integer value specifying the number of minor tick intervals
|
1040
|
+
# between major tick marks on the Y axis. Values of 0 or 1 imply no minor
|
1041
|
+
# ticks. Negative values specify no labels will be drawn for the associated
|
1042
|
+
# axis.
|
1043
|
+
# @param tick_size [Numeric]
|
1044
|
+
# The length of minor tick marks specified in a normalized device
|
1045
|
+
# coordinate unit. Major tick marks are twice as long as minor tick marks.
|
1046
|
+
# A negative value reverses the tick marks on the axes from inward facing
|
1047
|
+
# to outward facing (or vice versa).
|
1048
|
+
# @param fpx [Pointer]
|
1049
|
+
# Function pointer to a function that returns a label for a given tick on
|
1050
|
+
# the X axis. The callback function should have the following arguments.
|
1051
|
+
# @param fpy [Pointer] Exactly same as the fpx above, but for the the Y axis.
|
956
1052
|
#
|
957
|
-
#
|
958
|
-
#
|
959
|
-
#
|
960
|
-
|
961
|
-
|
962
|
-
|
1053
|
+
# * fpx/fpy
|
1054
|
+
# * param x [Numeric] NDC of the label in X direction.
|
1055
|
+
# * param y [Numeric] NDC of the label in Y direction.
|
1056
|
+
# * param svalue [String] Internal string representation of the text drawn by GR at (x,y).
|
1057
|
+
# * param value [Numeric] Floating point representation of the label drawn at (x,y).
|
1058
|
+
#
|
1059
|
+
# @!method axeslbl
|
963
1060
|
|
964
1061
|
# Draw a linear and/or logarithmic grid.
|
965
|
-
# @param x_tick [Numeric] The length in world coordinates of the interval between minor grid lines.
|
966
|
-
# @param y_tick [Numeric] The length in world coordinates of the interval between minor grid lines.
|
967
|
-
# @param z_tick [Numeric] The length in world coordinates of the interval between minor grid lines.
|
968
|
-
# @param x_org [Numeric] The world coordinates of the origin (point of intersection) of the grid.
|
969
|
-
# @param y_org [Numeric] The world coordinates of the origin (point of intersection) of the grid.
|
970
|
-
# @param z_org [Numeric] The world coordinates of the origin (point of intersection) of the grid.
|
971
|
-
# @param major_x [Integer]
|
972
|
-
# Unitless integer values specifying the number of minor grid lines
|
973
|
-
# between major grid lines. Values of 0 or 1 imply no grid lines.
|
974
|
-
# @param major_y [Integer]
|
975
|
-
# Unitless integer values specifying the number of minor grid lines
|
976
|
-
# between major grid lines. Values of 0 or 1 imply no grid lines.
|
977
|
-
# @param major_z [Integer]
|
978
|
-
# Unitless integer values specifying the number of minor grid lines
|
979
|
-
# between major grid lines. Values of 0 or 1 imply no grid lines.
|
980
1062
|
#
|
981
|
-
# Major grid lines correspond to the axes origin and major tick marks whether
|
982
|
-
# or not. Minor grid lines are drawn at points equal to minor tick
|
983
|
-
# lines are drawn using black lines and minor grid lines
|
984
|
-
|
985
|
-
|
986
|
-
|
1063
|
+
# Major grid lines correspond to the axes origin and major tick marks whether
|
1064
|
+
# visible or not. Minor grid lines are drawn at points equal to minor tick
|
1065
|
+
# marks. Major grid lines are drawn using black lines and minor grid lines
|
1066
|
+
# are drawn using gray lines.
|
1067
|
+
#
|
1068
|
+
# @param x_tick [Numeric] The length in world coordinates of the interval
|
1069
|
+
# between minor grid lines.
|
1070
|
+
# @param y_tick [Numeric] The length in world coordinates of the interval
|
1071
|
+
# between minor grid lines.
|
1072
|
+
# @param x_org [Numeric] The world coordinates of the origin (point of
|
1073
|
+
# intersection) of the grid.
|
1074
|
+
# @param y_org [Numeric] The world coordinates of the origin (point of
|
1075
|
+
# intersection) of the grid.
|
1076
|
+
# @param major_x [Integer] Unitless integer values specifying the number of
|
1077
|
+
# minor grid lines between major grid lines.
|
1078
|
+
# Values of 0 or 1 imply no grid lines.
|
1079
|
+
# @param major_y [Integer] Unitless integer values specifying the number of
|
1080
|
+
# minor grid lines between major grid lines.
|
1081
|
+
# Values of 0 or 1 imply no grid lines.
|
1082
|
+
#
|
1083
|
+
# @!method grid
|
1084
|
+
|
1085
|
+
# Draw a linear and/or logarithmic grid.
|
1086
|
+
#
|
1087
|
+
# Major grid lines correspond to the axes origin and major tick marks whether
|
1088
|
+
# visible or not. Minor grid lines are drawn at points equal to minor tick
|
1089
|
+
# marks. Major grid lines are drawn using black lines and minor grid lines
|
1090
|
+
# are drawn using gray lines.
|
1091
|
+
#
|
1092
|
+
# @param x_tick [Numeric] The length in world coordinates of the interval
|
1093
|
+
# between minor grid lines.
|
1094
|
+
# @param y_tick [Numeric] The length in world coordinates of the interval
|
1095
|
+
# between minor grid lines.
|
1096
|
+
# @param z_tick [Numeric] The length in world coordinates of the interval
|
1097
|
+
# between minor grid lines.
|
1098
|
+
# @param x_org [Numeric] The world coordinates of the origin (point of
|
1099
|
+
# intersection) of the grid.
|
1100
|
+
# @param y_org [Numeric] The world coordinates of the origin (point of
|
1101
|
+
# intersection) of the grid.
|
1102
|
+
# @param z_org [Numeric] The world coordinates of the origin (point of
|
1103
|
+
# intersection) of the grid.
|
1104
|
+
# @param major_x [Integer] Unitless integer values specifying the number
|
1105
|
+
# of minor grid lines between major grid lines.
|
1106
|
+
# Values of 0 or 1 imply no grid lines.
|
1107
|
+
# @param major_y [Integer] Unitless integer values specifying the number
|
1108
|
+
# of minor grid lines between major grid lines.
|
1109
|
+
# Values of 0 or 1 imply no grid lines.
|
1110
|
+
# @param major_z [Integer] Unitless integer values specifying the number of
|
1111
|
+
# minor grid lines between major grid lines.
|
1112
|
+
# Values of 0 or 1 imply no grid lines.
|
1113
|
+
#
|
1114
|
+
# @!method grid3d
|
987
1115
|
|
988
1116
|
# Draw a standard vertical error bar graph.
|
989
|
-
#
|
990
|
-
# @param
|
1117
|
+
#
|
1118
|
+
# @param x [Array, NArray] A list of length N containing the X coordinates
|
1119
|
+
# @param y [Array, NArray] A list of length N containing the Y coordinates
|
991
1120
|
# @param e1 [Array, NArray] The absolute values of the lower error bar data
|
992
1121
|
# @param e2 [Array, NArray] The absolute values of the lower error bar data
|
1122
|
+
#
|
993
1123
|
def verrorbars(x, y, e1, e2)
|
994
1124
|
n = equal_length(x, y, e1, e2)
|
995
1125
|
super(n, x, y, e1, e2)
|
996
1126
|
end
|
997
1127
|
|
998
1128
|
# Draw a standard horizontal error bar graph.
|
1129
|
+
#
|
999
1130
|
# @param x [Array, NArray] A list of length N containing the X coordinates
|
1000
1131
|
# @param y [Array, NArray] A list of length N containing the Y coordinates
|
1001
1132
|
# @param e1 [Array, NArray] The absolute values of the lower error bar data
|
1002
1133
|
# @param e2 [Array, NArray] The absolute values of the lower error bar data
|
1134
|
+
#
|
1003
1135
|
def herrorbars(x, y, e1, e2)
|
1004
1136
|
n = equal_length(x, y, e1, e2)
|
1005
1137
|
super(n, x, y, e1, e2)
|
@@ -1007,24 +1139,30 @@ module GR
|
|
1007
1139
|
|
1008
1140
|
# Draw a 3D curve using the current line attributes,
|
1009
1141
|
# starting from the first data point and ending at the last data point.
|
1010
|
-
#
|
1011
|
-
# @param y [Array, NArray] A list of length N containing the Y coordinates
|
1012
|
-
# @param z [Array, NArray] A list of length N containing the Z coordinates
|
1142
|
+
#
|
1013
1143
|
# The values for `x`, `y` and `z` are in world coordinates. The attributes that
|
1014
1144
|
# control the appearance of a polyline are linetype, linewidth and color
|
1015
1145
|
# index.
|
1146
|
+
#
|
1147
|
+
# @param x [Array, NArray] A list of length N containing the X coordinates
|
1148
|
+
# @param y [Array, NArray] A list of length N containing the Y coordinates
|
1149
|
+
# @param z [Array, NArray] A list of length N containing the Z coordinates
|
1150
|
+
#
|
1016
1151
|
def polyline3d(x, y, z)
|
1017
1152
|
n = equal_length(x, y, z)
|
1018
1153
|
super(n, x, y, z)
|
1019
1154
|
end
|
1020
1155
|
|
1021
1156
|
# Draw marker symbols centered at the given 3D data points.
|
1022
|
-
#
|
1023
|
-
# @param y [Array, NArray] A list of length N containing the Y coordinates
|
1024
|
-
# @param z [Array, NArray] A list of length N containing the Z coordinates
|
1157
|
+
#
|
1025
1158
|
# The values for `x`, `y` and `z` are in world coordinates. The attributes
|
1026
1159
|
# that control the appearance of a polymarker are marker type, marker size
|
1027
1160
|
# scale factor and color index.
|
1161
|
+
#
|
1162
|
+
# @param x [Array, NArray] A list of length N containing the X coordinates
|
1163
|
+
# @param y [Array, NArray] A list of length N containing the Y coordinates
|
1164
|
+
# @param z [Array, NArray] A list of length N containing the Z coordinates
|
1165
|
+
#
|
1028
1166
|
def polymarker3d(x, y, z)
|
1029
1167
|
n = equal_length(x, y, z)
|
1030
1168
|
super(n, x, y, z)
|
@@ -1032,12 +1170,24 @@ module GR
|
|
1032
1170
|
|
1033
1171
|
# Draw X, Y and Z coordinate axes with linearly and/or logarithmically
|
1034
1172
|
# spaced tick marks.
|
1173
|
+
#
|
1174
|
+
# Tick marks are positioned along each axis so that major tick marks fall on
|
1175
|
+
# the axes origin (whether visible or not). Major tick marks are labeled with
|
1176
|
+
# the corresponding data values. Axes are drawn according to the scale of the
|
1177
|
+
# window. Axes and tick marks are drawn using solid lines; line color and
|
1178
|
+
# width can be modified using the `setlinetype` and `setlinewidth` functions.
|
1179
|
+
# Axes are drawn according to the linear or logarithmic transformation
|
1180
|
+
# established by the `setscale` function.
|
1181
|
+
#
|
1035
1182
|
# @param x_tick [Numeric] The interval between minor tick marks on the X axis.
|
1036
1183
|
# @param y_tick [Numeric] The interval between minor tick marks on the Y axis.
|
1037
1184
|
# @param z_tick [Numeric] The interval between minor tick marks on the Z axis.
|
1038
|
-
# @param x_org
|
1039
|
-
#
|
1040
|
-
# @param
|
1185
|
+
# @param x_org [Numeric]
|
1186
|
+
# The world coordinates of the origin (point of intersection) of the X axes.
|
1187
|
+
# @param y_org [Numeric]
|
1188
|
+
# The world coordinates of the origin (point of intersection) of the Y axes.
|
1189
|
+
# @param z_org [Numeric]
|
1190
|
+
# The world coordinates of the origin (point of intersection) of the Z axes.
|
1041
1191
|
# @param major_x [Integer]
|
1042
1192
|
# Unitless integer values specifying the number of minor tick intervals
|
1043
1193
|
# between major tick marks. Values of 0 or 1 imply no minor ticks.
|
@@ -1055,48 +1205,41 @@ module GR
|
|
1055
1205
|
# coordinate unit. Major tick marks are twice as long as minor tick marks.
|
1056
1206
|
# A negative value reverses the tick marks on the axes from inward facing
|
1057
1207
|
# to outward facing (or vice versa).
|
1058
|
-
#
|
1059
|
-
#
|
1060
|
-
# data values. Axes are drawn according to the scale of the window. Axes and tick marks
|
1061
|
-
# are drawn using solid lines; line color and width can be modified using the
|
1062
|
-
# `setlinetype` and `setlinewidth` functions. Axes are drawn according to
|
1063
|
-
# the linear or logarithmic transformation established by the `setscale` function.
|
1064
|
-
def axes3d(*)
|
1065
|
-
super
|
1066
|
-
end
|
1208
|
+
#
|
1209
|
+
# @!method axes3d
|
1067
1210
|
|
1068
1211
|
# Display axis titles just outside of their respective axes.
|
1212
|
+
#
|
1069
1213
|
# @param x_title [String] The text to be displayed on the X axis
|
1070
1214
|
# @param x_title [String] The text to be displayed on the Y axis
|
1071
1215
|
# @param x_title [String] The text to be displayed on the Z axis
|
1072
|
-
|
1073
|
-
|
1074
|
-
end
|
1216
|
+
#
|
1217
|
+
# @!method titles3d
|
1075
1218
|
|
1076
1219
|
# Draw a three-dimensional surface plot for the given data points.
|
1220
|
+
#
|
1221
|
+
# `x` and `y` define a grid. `z` is a singly dimensioned array containing at
|
1222
|
+
# least `nx` * `ny` data points. Z describes the surface height at each point
|
1223
|
+
# on the grid. Data is ordered as shown in the table:
|
1224
|
+
#
|
1225
|
+
# @note `surface` is overwritten by `require gr/plot`.
|
1226
|
+
# The original method is moved to the underscored name.
|
1227
|
+
# The yard document will show the method name after evacuation.
|
1228
|
+
#
|
1077
1229
|
# @param x [Array, NArray] A list containing the X coordinates
|
1078
1230
|
# @param y [Array, NArray] A list containing the Y coordinates
|
1079
1231
|
# @param z [Array, NArray]
|
1080
1232
|
# A list of length `len(x)` * `len(y)` or an appropriately dimensioned
|
1081
1233
|
# array containing the Z coordinates
|
1082
1234
|
# @param option [Integer] Surface display option
|
1083
|
-
# * 0 LINES
|
1084
|
-
#
|
1085
|
-
# *
|
1086
|
-
#
|
1087
|
-
# *
|
1088
|
-
#
|
1089
|
-
# * 3
|
1090
|
-
#
|
1091
|
-
# * 4 COLORED_MESH
|
1092
|
-
# * Applies a colored grid to the surface
|
1093
|
-
# * 5 CELL_ARRAY
|
1094
|
-
# * Applies a grid of individually-colored cells to the surface
|
1095
|
-
# * 6 SHADED_MESH
|
1096
|
-
# * Applies light source shading to the 3-D surface
|
1097
|
-
# `x` and `y` define a grid. `z` is a singly dimensioned array containing at least
|
1098
|
-
# `nx` * `ny` data points. Z describes the surface height at each point on the grid.
|
1099
|
-
# Data is ordered as shown in the table:
|
1235
|
+
# * 0 LINES - Use X Y polylines to denote the surface
|
1236
|
+
# * 1 MESH - Use a wire grid to denote the surface
|
1237
|
+
# * 2 FILLED_MESH - Applies an opaque grid to the surface
|
1238
|
+
# * 3 Z_SHADED_MESH - Applies Z-value shading to the surface
|
1239
|
+
# * 4 COLORED_MESH - Applies a colored grid to the surface
|
1240
|
+
# * 5 CELL_ARRAY - Applies a grid of individually-colored cells to the surface
|
1241
|
+
# * 6 SHADED_MESH - Applies light source shading to the 3-D surface
|
1242
|
+
#
|
1100
1243
|
def surface(x, y, z, option)
|
1101
1244
|
# TODO: check: Arrays have incorrect length or dimension.
|
1102
1245
|
nx = x.length
|
@@ -1104,12 +1247,17 @@ module GR
|
|
1104
1247
|
super(nx, ny, x, y, z, option)
|
1105
1248
|
end
|
1106
1249
|
|
1107
|
-
# Draw contours of a three-dimensional data set
|
1108
|
-
#
|
1109
|
-
#
|
1250
|
+
# Draw contours of a three-dimensional data set whose values are specified
|
1251
|
+
# over a rectangular mesh. Contour lines may optionally be labeled.
|
1252
|
+
#
|
1253
|
+
# @note `contour` is overwritten by `require gr/plot`.
|
1254
|
+
# The original method is moved to the underscored name.
|
1255
|
+
# The yard document will show the method name after evacuation.
|
1256
|
+
#
|
1110
1257
|
# @param x [Array, NArray] A list containing the X coordinates
|
1111
1258
|
# @param y [Array, NArray] A list containing the Y coordinates
|
1112
|
-
# @param h [Array, NArray]
|
1259
|
+
# @param h [Array, NArray]
|
1260
|
+
# A list containing the Z coordinate for the height values
|
1113
1261
|
# @param z [Array, NArray]
|
1114
1262
|
# A list containing the Z coordinate for the height values
|
1115
1263
|
# A list of length `len(x)` * `len(y)` or an appropriately dimensioned
|
@@ -1119,6 +1267,7 @@ module GR
|
|
1119
1267
|
# every third line. A value of 1 will label every line. A value of 0
|
1120
1268
|
# produces no labels. To produce colored contour lines, add an offset
|
1121
1269
|
# of 1000 to `major_h`.
|
1270
|
+
#
|
1122
1271
|
def contour(x, y, h, z, major_h)
|
1123
1272
|
# TODO: check: Arrays have incorrect length or dimension.
|
1124
1273
|
nx = x.length
|
@@ -1127,8 +1276,13 @@ module GR
|
|
1127
1276
|
super(nx, ny, nh, x, y, h, z, major_h)
|
1128
1277
|
end
|
1129
1278
|
|
1130
|
-
# Draw filled contours of a three-dimensional data set
|
1131
|
-
#
|
1279
|
+
# Draw filled contours of a three-dimensional data set whose values are
|
1280
|
+
# specified over a rectangular mesh.
|
1281
|
+
#
|
1282
|
+
# @note `contourf` is overwritten by `require gr/plot`.
|
1283
|
+
# The original method is moved to the underscored name.
|
1284
|
+
# The yard document will show the method name after evacuation.
|
1285
|
+
#
|
1132
1286
|
# @param x [Array, NArray] A list containing the X coordinates
|
1133
1287
|
# @param y [Array, NArray] A list containing the Y coordinates
|
1134
1288
|
# @param h [Array, NArray]
|
@@ -1138,6 +1292,7 @@ module GR
|
|
1138
1292
|
# @param z [Array, NArray]
|
1139
1293
|
# A list of length `len(x)` * `len(y)` or an appropriately dimensioned
|
1140
1294
|
# array containing the Z coordinates
|
1295
|
+
#
|
1141
1296
|
def contourf(x, y, h, z, major_h)
|
1142
1297
|
# TODO: check: Arrays have incorrect length or dimension.
|
1143
1298
|
nx = x.length
|
@@ -1147,28 +1302,59 @@ module GR
|
|
1147
1302
|
end
|
1148
1303
|
|
1149
1304
|
# Draw a contour plot for the given triangle mesh.
|
1305
|
+
#
|
1306
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
1307
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
1308
|
+
# @param z [Array, NArray] A list containing the Z coordinates
|
1309
|
+
# @param lavels [Array, NArray] A list of contour levels
|
1310
|
+
#
|
1150
1311
|
def tricontour(x, y, z, levels)
|
1151
1312
|
npoints = x.length # equal_length ?
|
1152
1313
|
nlevels = levels.length
|
1153
1314
|
super(npoints, x, y, z, nlevels, levels)
|
1154
1315
|
end
|
1155
1316
|
|
1317
|
+
# @note `hexbin` is overwritten by `require gr/plot`.
|
1318
|
+
# The original method is moved to the underscored name.
|
1319
|
+
# The yard document will show the method name after evacuation.
|
1320
|
+
#
|
1156
1321
|
# @return [Integer]
|
1157
1322
|
def hexbin(x, y, nbins)
|
1158
1323
|
n = x.length
|
1159
1324
|
super(n, x, y, nbins)
|
1160
1325
|
end
|
1161
1326
|
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1327
|
+
# Set the currently used colormap.
|
1328
|
+
#
|
1329
|
+
# * A list of colormaps can be found at: https://gr-framework.org/colormaps.html
|
1330
|
+
# Using a negative index will use the reverse of the selected colormap.
|
1331
|
+
#
|
1332
|
+
# @param index [Integer] Colormap index
|
1333
|
+
#
|
1334
|
+
# @!method setcolormap
|
1165
1335
|
|
1166
1336
|
# inqcolormap
|
1167
1337
|
def inqcolormap
|
1168
1338
|
inquiry_int { |pt| super(pt) }
|
1169
1339
|
end
|
1170
1340
|
|
1171
|
-
#
|
1341
|
+
# Define a colormap by a list of RGB colors.
|
1342
|
+
# @note GR.jl and python-gr have different APIsI
|
1343
|
+
#
|
1344
|
+
# This function defines a colormap using the n given color intensities.
|
1345
|
+
# If less than 256 colors are provided the colors intensities are linear
|
1346
|
+
# interpolated. If x is NULL the given color values are evenly distributed
|
1347
|
+
# in the colormap. Otherwise the normalized value of x defines the position
|
1348
|
+
# of the color in the colormap.
|
1349
|
+
#
|
1350
|
+
# @param r [Array, NArray] The red intensities in range 0.0 to 1.0
|
1351
|
+
# @param g [Array, NArray] The green intensities in range 0.0 to 1.0
|
1352
|
+
# @param b [Array, NArray] The blue intensities in range 0.0 to 1.0
|
1353
|
+
# @param positions [Array, NArray]
|
1354
|
+
# The positions of the corresponding color in the resulting colormap or nil.
|
1355
|
+
# The values of positions must increase monotonically from 0.0 to 1.0.
|
1356
|
+
# If positions is nil the given colors are evenly distributed in the colormap.
|
1357
|
+
#
|
1172
1358
|
def setcolormapfromrgb(r, g, b, positions: nil)
|
1173
1359
|
n = equal_length(r, g, b)
|
1174
1360
|
if positions.nil?
|
@@ -1179,9 +1365,7 @@ module GR
|
|
1179
1365
|
super(n, r, g, b, positions)
|
1180
1366
|
end
|
1181
1367
|
|
1182
|
-
|
1183
|
-
super
|
1184
|
-
end
|
1368
|
+
# @!method colorbar
|
1185
1369
|
|
1186
1370
|
def inqcolor(color)
|
1187
1371
|
inquiry_int do |rgb|
|
@@ -1190,9 +1374,7 @@ module GR
|
|
1190
1374
|
end
|
1191
1375
|
|
1192
1376
|
# @return [Integer]
|
1193
|
-
|
1194
|
-
super
|
1195
|
-
end
|
1377
|
+
# @!method inqcolorfromrgb
|
1196
1378
|
|
1197
1379
|
def hsvtorgb(h, s, v)
|
1198
1380
|
inquiry %i[double double double] do |r, g, b|
|
@@ -1201,14 +1383,10 @@ module GR
|
|
1201
1383
|
end
|
1202
1384
|
|
1203
1385
|
# @return [Numeric]
|
1204
|
-
|
1205
|
-
super
|
1206
|
-
end
|
1386
|
+
# @!method tick
|
1207
1387
|
|
1208
1388
|
# @return [Integer]
|
1209
|
-
|
1210
|
-
super
|
1211
|
-
end
|
1389
|
+
# @!method validaterange
|
1212
1390
|
|
1213
1391
|
def adjustlimits(amin, amax)
|
1214
1392
|
inquiry %i[double double] do |pamin, pamax|
|
@@ -1227,24 +1405,28 @@ module GR
|
|
1227
1405
|
end
|
1228
1406
|
|
1229
1407
|
# Open and activate a print device.
|
1408
|
+
#
|
1409
|
+
# `beginprint` opens an additional graphics output device. The device type is obtained
|
1410
|
+
# from the given file extension
|
1411
|
+
#
|
1230
1412
|
# @param pathname [String] Filename for the print device.
|
1231
1413
|
# The following file types are supported:
|
1232
|
-
# * .ps, .eps
|
1233
|
-
# * .pdf
|
1234
|
-
# * .bmp
|
1414
|
+
# * .ps, .eps : PostScript
|
1415
|
+
# * .pdf : Portable Document Format
|
1416
|
+
# * .bmp : Windows Bitmap (BMP)
|
1235
1417
|
# * .jpeg, .jpg : JPEG image file
|
1236
|
-
# * .png
|
1418
|
+
# * .png : Portable Network Graphics file (PNG)
|
1237
1419
|
# * .tiff, .tif : Tagged Image File Format (TIFF)
|
1238
|
-
# * .
|
1239
|
-
# * .
|
1240
|
-
# * .
|
1241
|
-
#
|
1242
|
-
#
|
1243
|
-
|
1244
|
-
|
1245
|
-
end
|
1420
|
+
# * .svg : Scalable Vector Graphics
|
1421
|
+
# * .wmf : Windows Metafile
|
1422
|
+
# * .mp4 : MPEG-4 video file
|
1423
|
+
# * .webm : WebM video file
|
1424
|
+
# * .ogg : Ogg video file
|
1425
|
+
#
|
1426
|
+
# @!method beginprint
|
1246
1427
|
|
1247
1428
|
# Open and activate a print device with the given layout attributes.
|
1429
|
+
#
|
1248
1430
|
# @param pathname [String] Filename for the print device.
|
1249
1431
|
# @param mode [String] Output mode (Color, GrayScale)
|
1250
1432
|
# @param fmt [String] Output format
|
@@ -1280,13 +1462,10 @@ module GR
|
|
1280
1462
|
# * Ledger : 0.432 x 0.279
|
1281
1463
|
# * Tabloid : 0.279 x 0.432
|
1282
1464
|
# @param orientation [String] Page orientation (Landscape, Portait)
|
1283
|
-
|
1284
|
-
|
1285
|
-
end
|
1465
|
+
#
|
1466
|
+
# @!method beginprintext
|
1286
1467
|
|
1287
|
-
|
1288
|
-
super
|
1289
|
-
end
|
1468
|
+
# @!method endprint
|
1290
1469
|
|
1291
1470
|
def ndctowc(x, y)
|
1292
1471
|
inquiry %i[double double] do |px, py|
|
@@ -1314,67 +1493,74 @@ module GR
|
|
1314
1493
|
end
|
1315
1494
|
|
1316
1495
|
# Draw a rectangle using the current line attributes.
|
1496
|
+
#
|
1317
1497
|
# @param xmin [Numeric] Lower left edge of the rectangle
|
1318
1498
|
# @param xmax [Numeric] Lower right edge of the rectangle
|
1319
1499
|
# @param ymin [Numeric] Upper left edge of the rectangle
|
1320
1500
|
# @param ymax [Numeric] Upper right edge of the rectangle
|
1321
|
-
|
1322
|
-
|
1323
|
-
end
|
1501
|
+
#
|
1502
|
+
# @!method drawrect
|
1324
1503
|
|
1325
1504
|
# Draw a filled rectangle using the current fill attributes.
|
1505
|
+
#
|
1326
1506
|
# @param xmin [Numeric] Lower left edge of the rectangle
|
1327
1507
|
# @param xmax [Numeric] Lower right edge of the rectangle
|
1328
1508
|
# @param ymin [Numeric] Upper left edge of the rectangle
|
1329
1509
|
# @param ymax [Numeric] Upper right edge of the rectangle
|
1330
|
-
|
1331
|
-
|
1332
|
-
end
|
1510
|
+
#
|
1511
|
+
# @!method fillrect
|
1333
1512
|
|
1334
1513
|
# Draw a circular or elliptical arc covering the specified rectangle.
|
1514
|
+
#
|
1515
|
+
# The resulting arc begins at `a1` and ends at `a2` degrees. Angles are
|
1516
|
+
# interpreted such that 0 degrees is at the 3 o'clock position. The center
|
1517
|
+
# of the arc is the center of the given rectangle.
|
1518
|
+
#
|
1335
1519
|
# @param xmin [Numeric] Lower left edge of the rectangle
|
1336
1520
|
# @param xmax [Numeric] Lower right edge of the rectangle
|
1337
1521
|
# @param ymin [Numeric] Upper left edge of the rectangle
|
1338
1522
|
# @param ymax [Numeric] Upper right edge of the rectangle
|
1339
|
-
# @param a1
|
1340
|
-
# @param a2
|
1341
|
-
#
|
1342
|
-
#
|
1343
|
-
# of the given rectangle.
|
1344
|
-
def drawarc(*)
|
1345
|
-
super
|
1346
|
-
end
|
1523
|
+
# @param a1 [Numeric] The start angle
|
1524
|
+
# @param a2 [Numeric] The end angle
|
1525
|
+
#
|
1526
|
+
# @!method drawarc
|
1347
1527
|
|
1348
1528
|
# Fill a circular or elliptical arc covering the specified rectangle.
|
1529
|
+
#
|
1530
|
+
# The resulting arc begins at `a1` and ends at `a2` degrees. Angles are
|
1531
|
+
# interpreted such that 0 degrees is at the 3 o'clock position. The center
|
1532
|
+
# of the arc is the center of the given rectangle.
|
1533
|
+
#
|
1349
1534
|
# @param xmin [Numeric] Lower left edge of the rectangle
|
1350
1535
|
# @param xmax [Numeric] Lower right edge of the rectangle
|
1351
1536
|
# @param ymin [Numeric] Upper left edge of the rectangle
|
1352
1537
|
# @param ymax [Numeric] Upper right edge of the rectangle
|
1353
1538
|
# @param a1 [Numeric] The start angle
|
1354
1539
|
# @param a2 [Numeric] The end angle
|
1355
|
-
#
|
1356
|
-
#
|
1357
|
-
# of the given rectangle.
|
1358
|
-
def fillarc(*)
|
1359
|
-
super
|
1360
|
-
end
|
1540
|
+
#
|
1541
|
+
# @!method fillarc
|
1361
1542
|
|
1362
|
-
# Draw simple and compound outlines consisting of line segments and bezier
|
1543
|
+
# Draw simple and compound outlines consisting of line segments and bezier
|
1544
|
+
# curves.
|
1545
|
+
#
|
1363
1546
|
# @param points [Array, NArray] (N, 2) array of (x, y) vertices
|
1364
1547
|
# @parm codes [Array, NArray] N-length array of path codes
|
1365
|
-
# * STOP
|
1366
|
-
# * MOVETO
|
1367
|
-
# * LINETO
|
1368
|
-
# * CURVE3
|
1369
|
-
# * CURVE4
|
1548
|
+
# * STOP : end the entire path
|
1549
|
+
# * MOVETO : move to the given vertex
|
1550
|
+
# * LINETO : draw a line from the current position to the given vertex
|
1551
|
+
# * CURVE3 : draw a quadratic Bézier curve
|
1552
|
+
# * CURVE4 : draw a cubic Bézier curve
|
1370
1553
|
# * CLOSEPOLY : draw a line segment to the start point of the current path
|
1371
|
-
# @parm fill [Integer]
|
1554
|
+
# @parm fill [Integer]
|
1555
|
+
# A flag indication whether resulting path is to be filled or not
|
1556
|
+
#
|
1372
1557
|
def drawpath(points, codes, fill)
|
1373
1558
|
len = codes.length
|
1374
1559
|
super(len, points, uint8(codes), fill)
|
1375
1560
|
end
|
1376
1561
|
|
1377
1562
|
# Set the arrow style to be used for subsequent arrow commands.
|
1563
|
+
#
|
1378
1564
|
# @param style [Integer] The arrow style to be used
|
1379
1565
|
# The default arrow style is 1.
|
1380
1566
|
# * 1 : simple, single-ended
|
@@ -1396,29 +1582,30 @@ module GR
|
|
1396
1582
|
# * 17 : double line, single-ended
|
1397
1583
|
# * 18 : double line, double-ended
|
1398
1584
|
# `setarrowstyle` defines the arrow style for subsequent arrow primitives.
|
1399
|
-
|
1400
|
-
|
1401
|
-
end
|
1585
|
+
#
|
1586
|
+
# @!method setarrowstyle
|
1402
1587
|
|
1403
1588
|
# Set the arrow size to be used for subsequent arrow commands.
|
1404
|
-
#
|
1589
|
+
#
|
1405
1590
|
# `setarrowsize` defines the arrow size for subsequent arrow primitives.
|
1406
1591
|
# The default arrow size is 1.
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1592
|
+
#
|
1593
|
+
# @param size [Numeric] The arrow size to be used
|
1594
|
+
#
|
1595
|
+
# @!method setarrowsize
|
1410
1596
|
|
1411
1597
|
# Draw an arrow between two points.
|
1598
|
+
#
|
1599
|
+
# Different arrow styles (angles between arrow tail and wing, optionally
|
1600
|
+
# filled heads, double headed arrows) are available and can be set with the
|
1601
|
+
# `setarrowstyle` function.
|
1602
|
+
#
|
1412
1603
|
# @param x1 [Numeric] Starting point of the arrow (tail)
|
1413
1604
|
# @param y1 [Numeric] Starting point of the arrow (tail)
|
1414
1605
|
# @param x2 [Numeric] Head of the arrow
|
1415
1606
|
# @param y2 [Numeric] Head of the arrow
|
1416
|
-
#
|
1417
|
-
#
|
1418
|
-
# function.
|
1419
|
-
def drawarrow(*)
|
1420
|
-
super
|
1421
|
-
end
|
1607
|
+
#
|
1608
|
+
# @!method drawarrow
|
1422
1609
|
|
1423
1610
|
# @return [Integer]
|
1424
1611
|
def readimage(path)
|
@@ -1434,35 +1621,35 @@ module GR
|
|
1434
1621
|
end
|
1435
1622
|
|
1436
1623
|
# Draw an image into a given rectangular area.
|
1437
|
-
#
|
1438
|
-
#
|
1439
|
-
#
|
1440
|
-
#
|
1441
|
-
#
|
1624
|
+
#
|
1625
|
+
# The points (`xmin`, `ymin`) and (`xmax`, `ymax`) are world coordinates
|
1626
|
+
# defining diagonally opposite corner points of a rectangle. This rectangle
|
1627
|
+
# is divided into `width` by `height` cells. The two-dimensional array `data`
|
1628
|
+
# specifies colors for each cell.
|
1629
|
+
#
|
1630
|
+
# @param xmin [Numeric] First corner point of the rectangle
|
1631
|
+
# @param ymin [Numeric] First corner point of the rectangle
|
1632
|
+
# @param xmax [Numeric] Second corner point of the rectangle
|
1633
|
+
# @param ymax [Numeric] Second corner point of the rectangle
|
1634
|
+
# @param width [Integer] The width and the height of the image
|
1442
1635
|
# @param height [Integer] The width and the height of the image
|
1443
|
-
# @param data
|
1444
|
-
# @param model
|
1636
|
+
# @param data [Array, NArray] An array of color values dimensioned `width` by `height`
|
1637
|
+
# @param model [Integer] Color model ( default = 0 )
|
1445
1638
|
# The available color models are:
|
1446
|
-
# * 0 : MODEL_RGB
|
1447
|
-
#
|
1448
|
-
#
|
1449
|
-
# * AAVVSSHH
|
1450
|
-
# The points (`xmin`, `ymin`) and (`xmax`, `ymax`) are world coordinates defining
|
1451
|
-
# diagonally opposite corner points of a rectangle. This rectangle is divided into
|
1452
|
-
# `width` by `height` cells. The two-dimensional array `data` specifies colors
|
1453
|
-
# for each cell.
|
1639
|
+
# * 0 : MODEL_RGB - AABBGGRR
|
1640
|
+
# * 1 : MODEL_HSV - AAVVSSHH
|
1641
|
+
#
|
1454
1642
|
def drawimage(xmin, xmax, ymin, ymax, width, height, data, model = 0)
|
1455
1643
|
super(xmin, xmax, ymin, ymax, width, height, uint(data), model)
|
1456
1644
|
end
|
1457
1645
|
|
1458
1646
|
# @return [Integer]
|
1459
|
-
|
1460
|
-
super
|
1461
|
-
end
|
1647
|
+
# @!method importgraphics
|
1462
1648
|
|
1463
|
-
# `setshadow` allows drawing of shadows, realized by images painted
|
1464
|
-
# and offset from, graphics objects such that the shadow mimics
|
1465
|
-
# source cast on the graphics objects.
|
1649
|
+
# `setshadow` allows drawing of shadows, realized by images painted
|
1650
|
+
# underneath, and offset from, graphics objects such that the shadow mimics
|
1651
|
+
# the effect of a light source cast on the graphics objects.
|
1652
|
+
#
|
1466
1653
|
# @param offsetx [Numeric]
|
1467
1654
|
# An x-offset, which specifies how far in the horizontal direction the
|
1468
1655
|
# shadow is offset from the object
|
@@ -1471,18 +1658,19 @@ module GR
|
|
1471
1658
|
# is offset from the object
|
1472
1659
|
# @param blur [Numeric]
|
1473
1660
|
# A blur value, which specifies whether the object has a hard or a diffuse edge
|
1474
|
-
|
1475
|
-
|
1476
|
-
end
|
1661
|
+
#
|
1662
|
+
# @!method setshadow
|
1477
1663
|
|
1478
1664
|
# Set the value of the alpha component associated with GR colors.
|
1665
|
+
#
|
1479
1666
|
# @param alpha [Numeric] An alpha value (0.0 - 1.0)
|
1480
|
-
|
1481
|
-
|
1482
|
-
end
|
1667
|
+
#
|
1668
|
+
# @!method settransparency
|
1483
1669
|
|
1484
1670
|
# Change the coordinate transformation according to the given matrix.
|
1671
|
+
#
|
1485
1672
|
# @param mat [Array, NArray] 2D transformation matrix
|
1673
|
+
#
|
1486
1674
|
def setcoordxform(mat)
|
1487
1675
|
raise if mat.size != 6
|
1488
1676
|
|
@@ -1490,17 +1678,15 @@ module GR
|
|
1490
1678
|
end
|
1491
1679
|
|
1492
1680
|
# Open a file for graphics output.
|
1681
|
+
#
|
1493
1682
|
# @param path [String] Filename for the graphics file.
|
1494
|
-
# `begingraphics` allows to write all graphics output into a XML-formatted
|
1495
|
-
# the `endgraphics` functions is called. The resulting file may
|
1496
|
-
# the `importgraphics` function.
|
1497
|
-
|
1498
|
-
|
1499
|
-
end
|
1683
|
+
# `begingraphics` allows to write all graphics output into a XML-formatted
|
1684
|
+
# file until the `endgraphics` functions is called. The resulting file may
|
1685
|
+
# later be imported with the `importgraphics` function.
|
1686
|
+
#
|
1687
|
+
# @!method begingraphics
|
1500
1688
|
|
1501
|
-
|
1502
|
-
super
|
1503
|
-
end
|
1689
|
+
# @!method endgraphics
|
1504
1690
|
|
1505
1691
|
# @return [String]
|
1506
1692
|
def getgraphics(*)
|
@@ -1508,18 +1694,16 @@ module GR
|
|
1508
1694
|
end
|
1509
1695
|
|
1510
1696
|
# @return [Integer]
|
1511
|
-
|
1512
|
-
super
|
1513
|
-
end
|
1697
|
+
# @!method drawgraphics
|
1514
1698
|
|
1515
|
-
# Generate a character string starting at the given location. Strings can be
|
1516
|
-
# to create mathematical symbols and Greek letters using LaTeX syntax.
|
1517
|
-
#
|
1518
|
-
# @param
|
1699
|
+
# Generate a character string starting at the given location. Strings can be
|
1700
|
+
# defined to create mathematical symbols and Greek letters using LaTeX syntax.
|
1701
|
+
#
|
1702
|
+
# @param x [Numeric] X coordinate of the starting position of the text string
|
1703
|
+
# @param y [Numeric] Y coordinate of the starting position of the text string
|
1519
1704
|
# @param string [String] The text string to be drawn
|
1520
|
-
|
1521
|
-
|
1522
|
-
end
|
1705
|
+
#
|
1706
|
+
# @!method mathtex
|
1523
1707
|
|
1524
1708
|
# inqmathtex
|
1525
1709
|
def inqmathtex(x, y, string)
|
@@ -1528,21 +1712,13 @@ module GR
|
|
1528
1712
|
end
|
1529
1713
|
end
|
1530
1714
|
|
1531
|
-
|
1532
|
-
super
|
1533
|
-
end
|
1715
|
+
# @!method beginselection
|
1534
1716
|
|
1535
|
-
|
1536
|
-
super
|
1537
|
-
end
|
1717
|
+
# @!method endselection
|
1538
1718
|
|
1539
|
-
|
1540
|
-
super
|
1541
|
-
end
|
1719
|
+
# @!method moveselection
|
1542
1720
|
|
1543
|
-
|
1544
|
-
super
|
1545
|
-
end
|
1721
|
+
# @!method resizeselection
|
1546
1722
|
|
1547
1723
|
def inqbbox
|
1548
1724
|
inquiry %i[double double double double] do |*pts|
|
@@ -1551,39 +1727,23 @@ module GR
|
|
1551
1727
|
end
|
1552
1728
|
|
1553
1729
|
# @return [Numeric]
|
1554
|
-
|
1555
|
-
super
|
1556
|
-
end
|
1730
|
+
# @!method precision
|
1557
1731
|
|
1558
|
-
|
1559
|
-
super
|
1560
|
-
end
|
1732
|
+
# @!method setregenflags
|
1561
1733
|
|
1562
1734
|
# @return [Integer]
|
1563
|
-
|
1564
|
-
super
|
1565
|
-
end
|
1735
|
+
# @!method inqregenflags
|
1566
1736
|
|
1567
|
-
|
1568
|
-
super
|
1569
|
-
end
|
1737
|
+
# @!method savestate
|
1570
1738
|
|
1571
|
-
|
1572
|
-
super
|
1573
|
-
end
|
1739
|
+
# @!method restorestate
|
1574
1740
|
|
1575
|
-
|
1576
|
-
super
|
1577
|
-
end
|
1741
|
+
# @!method selectcontext
|
1578
1742
|
|
1579
|
-
|
1580
|
-
super
|
1581
|
-
end
|
1743
|
+
# @!method destroycontext
|
1582
1744
|
|
1583
1745
|
# @return [Integer]
|
1584
|
-
|
1585
|
-
super
|
1586
|
-
end
|
1746
|
+
# @!method uselinespec
|
1587
1747
|
|
1588
1748
|
def delaunay(x, y)
|
1589
1749
|
# Feel free to make a pull request if you catch a mistake
|
@@ -1606,6 +1766,11 @@ module GR
|
|
1606
1766
|
end
|
1607
1767
|
|
1608
1768
|
# Reduces the number of points of the x and y array.
|
1769
|
+
#
|
1770
|
+
# @param n [Integer] The requested number of points
|
1771
|
+
# @param x [Array, NArray] The x value array
|
1772
|
+
# @param y [Array, NArray] The y value array
|
1773
|
+
#
|
1609
1774
|
def reducepoints(xd, yd, n)
|
1610
1775
|
nd = equal_length(xd, yd)
|
1611
1776
|
inquiry [{ double: n }, { double: n }] do |x, y|
|
@@ -1615,9 +1780,11 @@ module GR
|
|
1615
1780
|
end
|
1616
1781
|
|
1617
1782
|
# Draw a triangular surface plot for the given data points.
|
1783
|
+
#
|
1618
1784
|
# @param x [Array, NArray] A list containing the X coordinates
|
1619
1785
|
# @param y [Array, NArray] A list containing the Y coordinates
|
1620
1786
|
# @param z [Array, NArray] A list containing the Z coordinates
|
1787
|
+
#
|
1621
1788
|
def trisurface(x, y, z)
|
1622
1789
|
n = [x, y, z].map(&:length).min
|
1623
1790
|
super(n, x, y, z)
|
@@ -1634,6 +1801,7 @@ module GR
|
|
1634
1801
|
end
|
1635
1802
|
|
1636
1803
|
# Draw a quiver plot on a grid of nx*ny points.
|
1804
|
+
#
|
1637
1805
|
# @param nx [Integer] The number of points along the x-axis of the grid
|
1638
1806
|
# @param ny [Integer] The number of points along the y-axis of the grid
|
1639
1807
|
# @param x [Array, NArray] A list containing the X coordinates
|
@@ -1643,7 +1811,9 @@ module GR
|
|
1643
1811
|
# @param color [Integer]
|
1644
1812
|
# A bool to indicate whether or not the arrows should be colored using
|
1645
1813
|
# the current colormap
|
1814
|
+
#
|
1646
1815
|
# The values for `x` and `y` are in world coordinates.
|
1816
|
+
#
|
1647
1817
|
def quiver(x, y, u, v, color)
|
1648
1818
|
# TODO: check: Arrays have incorrect length or dimension.
|
1649
1819
|
nx = x.length
|
@@ -1655,23 +1825,22 @@ module GR
|
|
1655
1825
|
# input points are located on a grid, described by `x`, `y` and `z`.
|
1656
1826
|
# The target grid ist described by `xq` and `yq`.
|
1657
1827
|
# Returns an array containing the resulting z-values.
|
1658
|
-
#
|
1659
|
-
# @param
|
1660
|
-
# @param
|
1828
|
+
#
|
1829
|
+
# @param x [Array, NArray] Array containing the input grid's x-values
|
1830
|
+
# @param y [Array, NArray] Array containing the input grid's y-values
|
1831
|
+
# @param z [Array, NArray] Array containing the input grid's z-values (number of values: nx * ny)
|
1661
1832
|
# @param xq [Array, NArray] Array containing the target grid's x-values
|
1662
1833
|
# @param yq [Array, NArray] Array containing the target grid's y-values
|
1663
1834
|
# @param method [Integer] Used method for interpolation
|
1664
1835
|
# The available methods for interpolation are the following:
|
1665
|
-
# * 0 : INTERP2_NEAREST
|
1666
|
-
#
|
1667
|
-
# *
|
1668
|
-
#
|
1669
|
-
# * 2 : INTERP_2_SPLINE
|
1670
|
-
# * Interpolation using natural cubic splines
|
1671
|
-
# * 3 : INTERP2_CUBIC
|
1672
|
-
# * Cubic interpolation
|
1836
|
+
# * 0 : INTERP2_NEAREST - Nearest neighbour interpolation
|
1837
|
+
# * 1 : INTERP2_LINEAR - Linear interpolation
|
1838
|
+
# * 2 : INTERP_2_SPLINE - Interpolation using natural cubic splines
|
1839
|
+
# * 3 : INTERP2_CUBIC - Cubic interpolation
|
1673
1840
|
# @param extrapval [Numeric] The extrapolation value
|
1674
|
-
|
1841
|
+
#
|
1842
|
+
# flatten
|
1843
|
+
def interp2(x, y, z, xq, yq, method, extrapval)
|
1675
1844
|
nx = x.length
|
1676
1845
|
ny = y.length
|
1677
1846
|
# nz = z.length
|
@@ -1683,34 +1852,34 @@ module GR
|
|
1683
1852
|
end
|
1684
1853
|
|
1685
1854
|
# Returns the combined version strings of the GR runtime.
|
1855
|
+
#
|
1686
1856
|
# @return [String]
|
1687
1857
|
def version
|
1688
1858
|
super.to_s
|
1689
1859
|
end
|
1690
1860
|
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1861
|
+
# @note `hexbin` is overwritten by `require gr/plot`.
|
1862
|
+
# The original method is moved to the underscored name.
|
1863
|
+
# The yard document will show the method name after evacuation.
|
1864
|
+
#
|
1865
|
+
# @!method shade
|
1694
1866
|
|
1695
1867
|
# Display a point set as a aggregated and rasterized image.
|
1696
|
-
#
|
1697
|
-
# @param y [Array, NArray] A pointer to the Y coordinates
|
1698
|
-
# @param dims [Array, NArray] The size of the grid used for rasterization
|
1699
|
-
# @param xform [Integer] The transformation type used for color mapping
|
1700
|
-
# The available transformation types are:
|
1701
|
-
# * 0 : XFORM_BOOLEAN
|
1702
|
-
# * boolean
|
1703
|
-
# * 1 : XFORM_LINEAR
|
1704
|
-
# * linear
|
1705
|
-
# * 2 : XFORM_LOG
|
1706
|
-
# * logarithmic
|
1707
|
-
# * 3 : XFORM_LOGLOG
|
1708
|
-
# * double logarithmic
|
1709
|
-
# * 4 : XFORM_CUBIC
|
1710
|
-
# * cubic
|
1711
|
-
# * 5 : XFORM_EQUALIZED
|
1712
|
-
# * histogram equalized
|
1868
|
+
#
|
1713
1869
|
# The values for `x` and `y` are in world coordinates.
|
1870
|
+
#
|
1871
|
+
# @param x [Array, NArray] A pointer to the X coordinates
|
1872
|
+
# @param y [Array, NArray] A pointer to the Y coordinates
|
1873
|
+
# @param dims [Array, NArray] The size of the grid used for rasterization
|
1874
|
+
# @param xform [Integer] The transformation type used for color mapping
|
1875
|
+
# The available transformation types are:
|
1876
|
+
# * 0 : XFORM_BOOLEAN - boolean
|
1877
|
+
# * 1 : XFORM_LINEAR - linear
|
1878
|
+
# * 2 : XFORM_LOG - logarithmic
|
1879
|
+
# * 3 : XFORM_LOGLOG - double logarithmic
|
1880
|
+
# * 4 : XFORM_CUBIC - cubic
|
1881
|
+
# * 5 : XFORM_EQUALIZED - histogram equalized
|
1882
|
+
#
|
1714
1883
|
def shadepoints(x, y, dims: [1200, 1200], xform: 1)
|
1715
1884
|
n = x.length
|
1716
1885
|
w, h = dims
|
@@ -1718,31 +1887,34 @@ module GR
|
|
1718
1887
|
end
|
1719
1888
|
|
1720
1889
|
# Display a line set as an aggregated and rasterized image.
|
1721
|
-
#
|
1722
|
-
# @param y [Array, NArray] A pointer to the Y coordinates
|
1723
|
-
# @param dims [Array, NArray] The size of the grid used for rasterization
|
1724
|
-
# @param xform [Integer] The transformation type used for color mapping
|
1725
|
-
# The available transformation types are:
|
1726
|
-
# * 0 : XFORM_BOOLEAN
|
1727
|
-
# * boolean
|
1728
|
-
# * 1 : XFORM_LINEAR
|
1729
|
-
# * linear
|
1730
|
-
# * 2 : XFORM_LOG
|
1731
|
-
# * logarithmic
|
1732
|
-
# * 3 : XFORM_LOGLOG
|
1733
|
-
# * double logarithmic
|
1734
|
-
# * 4 : XFORM_CUBIC
|
1735
|
-
# * cubic
|
1736
|
-
# * 5 : XFORM_EQUALIZED
|
1737
|
-
# * histogram equalized
|
1890
|
+
#
|
1738
1891
|
# The values for `x` and `y` are in world coordinates.
|
1739
1892
|
# NaN values can be used to separate the point set into line segments.
|
1893
|
+
#
|
1894
|
+
# @param x [Array, NArray] A pointer to the X coordinates
|
1895
|
+
# @param y [Array, NArray] A pointer to the Y coordinates
|
1896
|
+
# @param dims [Array, NArray] The size of the grid used for rasterization
|
1897
|
+
# @param xform [Integer] The transformation type used for color mapping
|
1898
|
+
# The available transformation types are:
|
1899
|
+
# * 0 : XFORM_BOOLEAN - boolean
|
1900
|
+
# * 1 : XFORM_LINEAR - linear
|
1901
|
+
# * 2 : XFORM_LOG - logarithmic
|
1902
|
+
# * 3 : XFORM_LOGLOG - double logarithmic
|
1903
|
+
# * 4 : XFORM_CUBIC - cubic
|
1904
|
+
# * 5 : XFORM_EQUALIZED - histogram equalized
|
1905
|
+
#
|
1740
1906
|
def shadelines(x, y, dims: [1200, 1200], xform: 1)
|
1741
1907
|
n = x.length
|
1742
1908
|
w, h = dims
|
1743
1909
|
super(n, x, y, xform, w, h)
|
1744
1910
|
end
|
1745
1911
|
|
1912
|
+
# @note This method uses GRCommons::Fiddley::Function as a callback function.
|
1913
|
+
# Please read the source code If you have to use it.
|
1914
|
+
# This method is not sure if it works properly.
|
1915
|
+
#
|
1916
|
+
# @!method findboundary
|
1917
|
+
|
1746
1918
|
# panzoom
|
1747
1919
|
def panzoom(x, y, zoom)
|
1748
1920
|
inquiry %i[double double double double] do |xmin, xmax, ymin, ymax|
|
@@ -1750,7 +1922,8 @@ module GR
|
|
1750
1922
|
end
|
1751
1923
|
end
|
1752
1924
|
|
1753
|
-
# Set the resample method used for
|
1925
|
+
# Set the resample method used for `drawimage`.
|
1926
|
+
#
|
1754
1927
|
# @param resample_method [Integer] the new resample method.
|
1755
1928
|
# The available options are:
|
1756
1929
|
# * 0x00000000 : RESAMPLE_DEFAULT
|
@@ -1761,7 +1934,8 @@ module GR
|
|
1761
1934
|
# * linear
|
1762
1935
|
# * 0x03030303 : RESAMPLE_LANCZOS
|
1763
1936
|
# * Lanczos
|
1764
|
-
# Alternatively, combinations of these methods can be selected for
|
1937
|
+
# Alternatively, combinations of these methods can be selected for
|
1938
|
+
# horizontal or vertical upsampling or downsampling:
|
1765
1939
|
# * 0x00000000 : UPSAMPLE_VERTICAL_DEFAULT
|
1766
1940
|
# * default for vertical upsampling
|
1767
1941
|
# * 0x00000000 : UPSAMPLE_HORIZONTAL_DEFAULT
|
@@ -1794,11 +1968,12 @@ module GR
|
|
1794
1968
|
# * lanczos for vertical downsampling
|
1795
1969
|
# * 0x03000000 : DOWNSAMPLE_HORIZONTAL_LANCZOS
|
1796
1970
|
# * lanczos for horizontal downsampling
|
1797
|
-
|
1798
|
-
|
1799
|
-
end
|
1971
|
+
#
|
1972
|
+
# @!method setresamplemethod
|
1800
1973
|
|
1801
|
-
# Inquire the resample method used for
|
1974
|
+
# Inquire the resample method used for `drawimage`
|
1975
|
+
#
|
1976
|
+
# @return [Integer] Resample flag
|
1802
1977
|
def inqresamplemethod
|
1803
1978
|
inquiry_uint do |resample_method|
|
1804
1979
|
super(resample_method)
|
@@ -1806,6 +1981,7 @@ module GR
|
|
1806
1981
|
end
|
1807
1982
|
|
1808
1983
|
# Draw paths using the given vertices and path codes.
|
1984
|
+
#
|
1809
1985
|
# @param x [Array, NArray] A list containing the X coordinates
|
1810
1986
|
# @param y [Array, NArray] A list containing the Y coordinates
|
1811
1987
|
# @param codes [String] A list containing the path codes
|
@@ -1830,128 +2006,133 @@ module GR
|
|
1830
2006
|
# * close path and fill -
|
1831
2007
|
# * F
|
1832
2008
|
# * close path, fill and stroke -
|
2009
|
+
#
|
1833
2010
|
# See https://gr-framework.org/python-gr.html#gr.path for more details.
|
2011
|
+
#
|
1834
2012
|
def path(x, y, codes)
|
1835
2013
|
n = equal_length(x, y)
|
1836
2014
|
super(n, x, y, codes)
|
1837
2015
|
end
|
1838
2016
|
|
1839
2017
|
# Define the border width of subsequent path output primitives.
|
2018
|
+
#
|
1840
2019
|
# @param width [Numeric] The border width scale factor
|
1841
|
-
|
1842
|
-
|
1843
|
-
end
|
2020
|
+
#
|
2021
|
+
# @!method setborderwidth
|
1844
2022
|
|
1845
2023
|
def inqborderwidth
|
1846
2024
|
inquiry_double { |pt| super(pt) }
|
1847
2025
|
end
|
1848
2026
|
|
1849
2027
|
# Define the color of subsequent path output primitives.
|
2028
|
+
#
|
1850
2029
|
# @param color [Integer] The border color index (COLOR < 1256)
|
1851
|
-
|
1852
|
-
|
1853
|
-
end
|
2030
|
+
#
|
2031
|
+
# @!method setbordercolorind
|
1854
2032
|
|
1855
2033
|
def inqbordercolorind
|
1856
2034
|
inquiry_int { |pt| super(pt) }
|
1857
2035
|
end
|
1858
2036
|
|
1859
2037
|
# Set the projection type with this flag.
|
2038
|
+
#
|
1860
2039
|
# @param flag [Integer] projection type
|
1861
2040
|
# The available options are:
|
1862
|
-
# * 0 : GR_PROJECTION_DEFAULT
|
1863
|
-
#
|
1864
|
-
# *
|
1865
|
-
#
|
1866
|
-
#
|
1867
|
-
# * perspective
|
1868
|
-
def setprojectiontype(*)
|
1869
|
-
super
|
1870
|
-
end
|
2041
|
+
# * 0 : GR_PROJECTION_DEFAULT - default
|
2042
|
+
# * 1 : GR_PROJECTION_ORTHOGRAPHIC - orthographic
|
2043
|
+
# * 2 : GR_PROJECTION_PERSPECTIVE - perspective
|
2044
|
+
#
|
2045
|
+
# @!method setprojectiontype
|
1871
2046
|
|
1872
2047
|
# Return the projection type.
|
1873
2048
|
def inqprojectiontype
|
1874
2049
|
inquiry_int { |pt| super(pt) }
|
1875
2050
|
end
|
1876
2051
|
|
2052
|
+
# Set the far and near clipping plane for perspective projection and the
|
2053
|
+
# vertical field ov view.
|
2054
|
+
# Switches projection type to perspective.
|
2055
|
+
#
|
2056
|
+
# @param near_plane [Numeric] distance to near clipping plane
|
2057
|
+
# @param far_plane [Numeric] distance to far clipping plane
|
2058
|
+
# @param fov [Numeric] vertical field of view,
|
2059
|
+
# input must be between 0 and 180 degrees
|
2060
|
+
#
|
2061
|
+
# @!method setperspectiveprojection
|
2062
|
+
|
2063
|
+
# Return the parameters for the perspective projection.
|
2064
|
+
def inqperspectiveprojection
|
2065
|
+
inquiry %i[double double double] do |*pts|
|
2066
|
+
super(*pts)
|
2067
|
+
end
|
2068
|
+
end
|
2069
|
+
|
1877
2070
|
# Method to set the camera position, the upward facing direction and the
|
1878
2071
|
# focus point of the shown volume.
|
1879
|
-
#
|
1880
|
-
# @param
|
1881
|
-
# @param
|
1882
|
-
# @param
|
1883
|
-
# @param
|
1884
|
-
# @param
|
2072
|
+
#
|
2073
|
+
# @param camera_pos_x [Numeric] x component of the cameraposition in world coordinates
|
2074
|
+
# @param camera_pos_y [Numeric] y component of the cameraposition in world coordinates
|
2075
|
+
# @param camera_pos_z [Numeric] z component of the cameraposition in world coordinates
|
2076
|
+
# @param up_x [Numeric] x component of the up vector
|
2077
|
+
# @param up_y [Numeric] y component of the up vector
|
2078
|
+
# @param up_z [Numeric] z component of the up vector
|
1885
2079
|
# @param focus_point_x [Numeric] x component of focus-point inside volume
|
1886
2080
|
# @param focus_point_y [Numeric] y component of focus-point inside volume
|
1887
2081
|
# @param focus_point_z [Numeric] z component of focus-point inside volume
|
1888
|
-
|
1889
|
-
|
1890
|
-
end
|
2082
|
+
#
|
2083
|
+
# @!method settransformationparameters
|
1891
2084
|
|
1892
2085
|
# Return the camera position, up vector and focus point.
|
2086
|
+
#
|
1893
2087
|
def inqtransformationparameters
|
1894
2088
|
inquiry([:double] * 9) do |*pts|
|
1895
2089
|
super(*pts)
|
1896
2090
|
end
|
1897
2091
|
end
|
1898
2092
|
|
1899
|
-
# Set the far and near clipping plane for perspective projection and the
|
1900
|
-
# vertical field ov view.
|
1901
|
-
# Switches projection type to perspective.
|
1902
|
-
# @param near_plane [Numeric] distance to near clipping plane
|
1903
|
-
# @param far_plane [Numeric] distance to far clipping plane
|
1904
|
-
# @param fov [Numeric] vertical field of view, input must be between 0 and 180 degrees
|
1905
|
-
def setperspectiveprojection(*)
|
1906
|
-
super
|
1907
|
-
end
|
1908
|
-
|
1909
|
-
# Return the parameters for the perspective projection.
|
1910
|
-
def inqperspectiveprojection
|
1911
|
-
inquiry %i[double double double] do |*pts|
|
1912
|
-
super(*pts)
|
1913
|
-
end
|
1914
|
-
end
|
1915
|
-
|
1916
2093
|
# Set parameters for orthographic transformation.
|
1917
2094
|
# Switches projection type to orthographic.
|
1918
|
-
#
|
1919
|
-
# @param
|
1920
|
-
# @param
|
1921
|
-
# @param
|
2095
|
+
#
|
2096
|
+
# @param left [Numeric] xmin of the volume in worldcoordinates
|
2097
|
+
# @param right [Numeric] xmax of volume in worldcoordinates
|
2098
|
+
# @param bottom [Numeric] ymin of volume in worldcoordinates
|
2099
|
+
# @param top [Numeric] ymax of volume in worldcoordinates
|
1922
2100
|
# @param near_plane [Numeric] distance to near clipping plane
|
1923
|
-
# @param far_plane
|
1924
|
-
|
1925
|
-
|
1926
|
-
end
|
2101
|
+
# @param far_plane [Numeric] distance to far clipping plane
|
2102
|
+
#
|
2103
|
+
# @!method setorthographicprojection
|
1927
2104
|
|
1928
2105
|
# Return the camera position, up vector and focus point.
|
2106
|
+
#
|
1929
2107
|
def inqorthographicprojection
|
1930
2108
|
inquiry([:double] * 6) do |*pts|
|
1931
2109
|
super(*pts)
|
1932
2110
|
end
|
1933
2111
|
end
|
1934
2112
|
|
1935
|
-
#
|
1936
|
-
#
|
2113
|
+
# Rotate the current scene according to a virtual arcball.
|
2114
|
+
#
|
2115
|
+
# This function requires values between 0 (left side or bottom of the drawing
|
2116
|
+
# area) and 1 (right side or top of the drawing area).
|
2117
|
+
#
|
1937
2118
|
# @param start_mouse_pos_x [Numeric] x component of the start mouse position
|
1938
2119
|
# @param start_mouse_pos_y [Numeric] y component of the start mouse position
|
1939
|
-
# @param end_mouse_pos_x
|
1940
|
-
# @param end_mouse_pos_y
|
1941
|
-
|
1942
|
-
|
1943
|
-
end
|
2120
|
+
# @param end_mouse_pos_x [Numeric] x component of the end mouse position
|
2121
|
+
# @param end_mouse_pos_y [Numeric] y component of the end mouse position
|
2122
|
+
#
|
2123
|
+
# @!method camerainteraction
|
1944
2124
|
|
1945
|
-
# Set the three dimensional window.
|
2125
|
+
# Set the three dimensional window.
|
2126
|
+
# Only used for perspective and orthographic projection.
|
2127
|
+
#
|
1946
2128
|
# @param xmin [Numeric] min x-value
|
1947
2129
|
# @param xmax [Numeric] max x-value
|
1948
2130
|
# @param ymin [Numeric] min y-value
|
1949
2131
|
# @param ymax [Numeric] max y-value
|
1950
2132
|
# @param zmin [Numeric] min z-value
|
1951
2133
|
# @param zmax [Numeric] max z-value
|
1952
|
-
|
1953
|
-
|
1954
|
-
end
|
2134
|
+
#
|
2135
|
+
# @!method setwindow3d
|
1955
2136
|
|
1956
2137
|
# Return the three dimensional window.
|
1957
2138
|
def inqwindow3d
|
@@ -1961,15 +2142,16 @@ module GR
|
|
1961
2142
|
end
|
1962
2143
|
|
1963
2144
|
# Set the scale factor for each axis. A one means no scale.
|
1964
|
-
#
|
2145
|
+
# The scaling factors must not be zero. .
|
2146
|
+
#
|
1965
2147
|
# @param x_axis_scale [Numeric] factor for scaling the x-axis
|
1966
2148
|
# @param y_axis_scale [Numeric] factor for scaling the y-axis
|
1967
2149
|
# @param z_axis_scale [Numeric] factor for scaling the z-axis
|
1968
|
-
|
1969
|
-
|
1970
|
-
end
|
2150
|
+
#
|
2151
|
+
# @!method setscalefactors3d
|
1971
2152
|
|
1972
2153
|
# Returns the scale factors for each axis.
|
2154
|
+
#
|
1973
2155
|
def inqscalefactors3d
|
1974
2156
|
inquiry %i[double double double] do |*opts|
|
1975
2157
|
super(*opts)
|
@@ -1977,24 +2159,23 @@ module GR
|
|
1977
2159
|
end
|
1978
2160
|
|
1979
2161
|
# Set the camera for orthographic or perspective projection.
|
2162
|
+
#
|
1980
2163
|
# The center of the 3d window is used as the focus point and the camera is
|
1981
2164
|
# positioned relative to it, using camera distance, rotation and tilt similar
|
1982
|
-
# to
|
2165
|
+
# to `setspace`. This function can be used if the user prefers spherical
|
1983
2166
|
# coordinates to setting the camera position directly, but has reduced
|
1984
2167
|
# functionality in comparison to GR.settransformationparameters,
|
1985
2168
|
# GR.setperspectiveprojection and GR.setorthographicprojection.
|
2169
|
+
#
|
1986
2170
|
# @param phi [Numeric] azimuthal angle of the spherical coordinates
|
1987
2171
|
# @param theta [Numeric] polar angle of the spherical coordinates
|
1988
2172
|
# @param fov [Numeric] vertical field of view (0 or NaN for orthographic projection)
|
1989
2173
|
# @param camera_distance [Numeric] distance between the camera and the focus point
|
1990
2174
|
# (0 or NaN for the radius of the object's smallest bounding sphere)
|
1991
|
-
|
1992
|
-
|
1993
|
-
end
|
2175
|
+
#
|
2176
|
+
# @!method setspace3d
|
1994
2177
|
|
1995
|
-
|
1996
|
-
super
|
1997
|
-
end
|
2178
|
+
# @!method text3d
|
1998
2179
|
|
1999
2180
|
def inqtext3d(x, y, z, string, axis)
|
2000
2181
|
inquiry [{ double: 16 }, { double: 16 }] do |tbx, tby|
|
@@ -2002,9 +2183,7 @@ module GR
|
|
2002
2183
|
end
|
2003
2184
|
end
|
2004
2185
|
|
2005
|
-
|
2006
|
-
super
|
2007
|
-
end
|
2186
|
+
# @!method settextencoding
|
2008
2187
|
|
2009
2188
|
def inqtextencoding
|
2010
2189
|
inquiry_int do |encoding|
|