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