ruby-gr 0.0.3 → 0.0.4
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/lib/gr.rb +970 -34
- data/lib/gr/ffi.rb +3 -0
- data/lib/gr3.rb +248 -82
- data/lib/gr3/ffi.rb +1 -0
- data/lib/gr_commons.rb +1 -0
- data/lib/gr_commons/attach_function.rb +1 -0
- data/lib/gr_commons/define_methods.rb +1 -0
- data/lib/gr_commons/gr_common_utils.rb +1 -0
- data/lib/gr_commons/jupyter_support.rb +12 -5
- data/lib/gr_commons/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b317ddec0fec1377dc02ab3df429656bf7ae1a4056ed039b3814b344be362e59
|
4
|
+
data.tar.gz: ed039b4fbac3b8e391039343924d8e8fdfe3cd2c72a8d5c6705d29170fc69809
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40828455aaed63f0eea89ec1eebc31c7c4f2a1a49e3e3b874cc80b08336cda2da5fad15f02c475ab4187ea18c7b996e2d5fbcfcdad61cbc01d53e2704af4b3fe
|
7
|
+
data.tar.gz: 8ebe911013ea044d6feca9e36dbf6a97d9d54e465b19659f06254c2b4e41414a398e5788770000301e03d0e06f6181e5d546cc582671816961a1ae3efc390f52
|
data/lib/gr.rb
CHANGED
@@ -56,18 +56,53 @@ module GR
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
# Open a graphical workstation.
|
60
|
+
# @param workstation_id [Integer] A workstation identifier.
|
61
|
+
# @param connection [String] A connection identifier.
|
62
|
+
# @param workstation_type [Integer] The desired workstation type.
|
63
|
+
# * 5 : Workstation Independent Segment Storage
|
64
|
+
# * 7, 8 : Computer Graphics Metafile (CGM binary, clear text)
|
65
|
+
# * 41 : Windows GDI
|
66
|
+
# * 51 : Mac Quickdraw
|
67
|
+
# * 61 - 64 : PostScript (b/w, color)
|
68
|
+
# * 101, 102 : Portable Document Format (plain, compressed)
|
69
|
+
# * 210 - 213 : X Windows
|
70
|
+
# * 214 : Sun Raster file (RF)
|
71
|
+
# * 215, 218 : Graphics Interchange Format (GIF87, GIF89)
|
72
|
+
# * 216 : Motif User Interface Language (UIL)
|
73
|
+
# * 320 : Windows Bitmap (BMP)
|
74
|
+
# * 321 : JPEG image file
|
75
|
+
# * 322 : Portable Network Graphics file (PNG)
|
76
|
+
# * 323 : Tagged Image File Format (TIFF)
|
77
|
+
# * 370 : Xfig vector graphics file
|
78
|
+
# * 371 : Gtk
|
79
|
+
# * 380 : wxWidgets
|
80
|
+
# * 381 : Qt4
|
81
|
+
# * 382 : Scaleable Vector Graphics (SVG)
|
82
|
+
# * 390 : Windows Metafile
|
83
|
+
# * 400 : Quartz
|
84
|
+
# * 410 : Socket driver
|
85
|
+
# * 415 : 0MQ driver
|
86
|
+
# * 420 : OpenGL
|
87
|
+
# * 430 : HTML5 Canvas
|
59
88
|
def openws(*)
|
60
89
|
super
|
61
90
|
end
|
62
91
|
|
92
|
+
# Close the specified workstation.
|
93
|
+
# @param workstation_id [Integer] A workstation identifier.
|
63
94
|
def closews(*)
|
64
95
|
super
|
65
96
|
end
|
66
97
|
|
98
|
+
# Activate the specified workstation.
|
99
|
+
# @param workstation_id [Integer] A workstation identifier.
|
67
100
|
def activatews(*)
|
68
101
|
super
|
69
102
|
end
|
70
103
|
|
104
|
+
# Deactivate the specified workstation.
|
105
|
+
# @param workstation_id [Integer] A workstation identifier.
|
71
106
|
def deactivatews(*)
|
72
107
|
super
|
73
108
|
end
|
@@ -86,22 +121,34 @@ module GR
|
|
86
121
|
|
87
122
|
# Draw a polyline using the current line attributes,
|
88
123
|
# starting from the first data point and ending at the last data point.
|
124
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
125
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
89
126
|
def polyline(x, y)
|
90
127
|
n = equal_length(x, y)
|
91
128
|
super(n, x, y)
|
92
129
|
end
|
93
130
|
|
94
131
|
# Draw marker symbols centered at the given data points.
|
132
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
133
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
95
134
|
def polymarker(x, y)
|
96
135
|
n = equal_length(x, y)
|
97
136
|
super(n, x, y)
|
98
137
|
end
|
99
138
|
|
139
|
+
# Draw a text at position `x`, `y` using the current text attributes.
|
140
|
+
# @param x [Numeric] The X coordinate of starting position of the text string
|
141
|
+
# @param y [Numeric] The Y coordinate of starting position of the text string
|
142
|
+
# @param string [String] The text to be drawn
|
143
|
+
#
|
144
|
+
# The values for `x` and `y` are in normalized device coordinates.
|
145
|
+
# The attributes that control the appearance of text are text font and precision,
|
146
|
+
# character expansion factor, character spacing, text color index, character
|
147
|
+
# height, character up vector, text path and text alignment.
|
100
148
|
def text(*)
|
101
149
|
super
|
102
150
|
end
|
103
151
|
|
104
|
-
# inqtext
|
105
152
|
def inqtext(x, y, string)
|
106
153
|
inquiry [{ double: 4 }, { double: 4 }] do |tbx, tby|
|
107
154
|
super(x, y, string, tbx, tby)
|
@@ -109,32 +156,72 @@ module GR
|
|
109
156
|
end
|
110
157
|
|
111
158
|
# Allows you to specify a polygonal shape of an area to be filled.
|
159
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
160
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
161
|
+
#
|
162
|
+
# The attributes that control the appearance of fill areas are fill area interior
|
163
|
+
# style, fill area style index and fill area color index.
|
112
164
|
def fillarea(x, y)
|
113
165
|
n = equal_length(x, y)
|
114
166
|
super(n, x, y)
|
115
167
|
end
|
116
168
|
|
117
|
-
# Display rasterlike images in a device-independent manner.
|
118
|
-
#
|
119
|
-
# each of them colored individually by the corresponding color index
|
169
|
+
# Display rasterlike images in a device-independent manner. The cell array
|
170
|
+
# function partitions a rectangle given by two corner points into DIMX X DIMY
|
171
|
+
# cells, each of them colored individually by the corresponding color index
|
172
|
+
# of the given cell array.
|
173
|
+
# @param xmin [Numeric] Lower left point of the rectangle
|
174
|
+
# @param ymin [Numeric] Lower left point of the rectangle
|
175
|
+
# @param xmax [Numeric] Upper right point of the rectangle
|
176
|
+
# @param ymax [Numeric] Upper right point of the rectangle
|
177
|
+
# @param dimx [Integer] X dimension of the color index array
|
178
|
+
# @param dimy [Integer] Y dimension of the color index array
|
179
|
+
# @param color [Array, NArray] Color index array
|
180
|
+
#
|
181
|
+
# The values for `xmin`, `xmax`, `ymin` and `ymax` are in world coordinates.
|
120
182
|
def cellarray(xmin, xmax, ymin, ymax, dimx, dimy, color)
|
121
183
|
super(xmin, xmax, ymin, ymax, dimx, dimy, 1, 1, dimx, dimy, int(color))
|
122
184
|
end
|
123
185
|
|
124
186
|
# Display a two dimensional color index array with nonuniform cell sizes.
|
187
|
+
# @param x [Array, NArray] X coordinates of the cell edges
|
188
|
+
# @param y [Array, NArray] Y coordinates of the cell edges
|
189
|
+
# @param dimx [Integer] X dimension of the color index array
|
190
|
+
# @param dimy [Integer] Y dimension of the color index array
|
191
|
+
# @param color [Array, NArray] Color index array
|
125
192
|
def nonuniformcellarray(x, y, dimx, dimy, color)
|
126
193
|
raise ArgumentError unless x.length == dimx + 1 && y.length == dimy + 1
|
127
194
|
|
128
195
|
super(x, y, dimx, dimy, 1, 1, dimx, dimy, int(color))
|
129
196
|
end
|
130
197
|
|
131
|
-
# Display a two dimensional color index array mapped to a disk using polar
|
198
|
+
# Display a two dimensional color index array mapped to a disk using polar
|
199
|
+
# coordinates.
|
200
|
+
# @param xorg [Numeric] X coordinate of the disk center in world coordinates
|
201
|
+
# @param yorg [Numeric] Y coordinate of the disk center in world coordinates
|
202
|
+
# @param phimin [Numeric] start angle of the disk sector in degrees
|
203
|
+
# @param phimax [Numeric] end angle of the disk sector in degrees
|
204
|
+
# @param rmin [Numeric] inner radius of the punctured disk in world coordinates
|
205
|
+
# @param rmax [Numeric] outer radius of the punctured disk in world coordinates
|
206
|
+
# @param dimiphi [Integer] Phi (X) dimension of the color index array
|
207
|
+
# @param dimr [Integer] iR (Y) dimension of the color index array
|
208
|
+
# @param color [Array, NArray] Color index array
|
209
|
+
#
|
210
|
+
# The two dimensional color index array is mapped to the resulting image by
|
211
|
+
# interpreting the X-axis of the array as the angle and the Y-axis as the raidus.
|
212
|
+
# The center point of the resulting disk is located at `xorg`, `yorg` and the
|
213
|
+
# radius of the disk is `rmax`.
|
132
214
|
def polarcellarray(x_org, y_org, phimin, phimax, rmin, rmax, dimphi, dimr, color)
|
133
215
|
super(x_org, y_org, phimin, phimax, rmin, rmax, dimphi, dimr, 1, 1, dimphi, dimr, int(color))
|
134
216
|
end
|
135
217
|
|
136
218
|
# Generates a generalized drawing primitive (GDP) of the type you specify,
|
137
|
-
# using specified points and any additional information contained in a data
|
219
|
+
# using specified points and any additional information contained in a data
|
220
|
+
# record.
|
221
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
222
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
223
|
+
# @param primid [Integer] Primitive identifier
|
224
|
+
# @param datrec [Array, NArray] Primitive data record
|
138
225
|
def gdp(x, y, primid, datrec)
|
139
226
|
n = equal_length(x, y)
|
140
227
|
ldr = datrec.length
|
@@ -143,12 +230,21 @@ module GR
|
|
143
230
|
|
144
231
|
# Generate a cubic spline-fit,
|
145
232
|
# starting from the first data point and ending at the last data point.
|
233
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
234
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
235
|
+
# @param m [Integer] The number of points in the polygon to be drawn (`m` > len(`x`))
|
236
|
+
# @param method [Integer] The smoothing method
|
237
|
+
# * If `method` is > 0, then a generalized cross-validated smoothing spline is calculated.
|
238
|
+
# * If `method` is 0, then an interpolating natural cubic spline is calculated.
|
239
|
+
# * If `method` is < -1, then a cubic B-spline is calculated.
|
240
|
+
# The values for `x` and `y` are in world coordinates. The attributes that
|
241
|
+
# control the appearance of a spline-fit are linetype, linewidth and color
|
242
|
+
# index.
|
146
243
|
def spline(px, py, m, method)
|
147
244
|
n = equal_length(px, py)
|
148
245
|
super(n, px, py, m, method)
|
149
246
|
end
|
150
247
|
|
151
|
-
# gridit
|
152
248
|
def gridit(xd, yd, zd, nx, ny)
|
153
249
|
nd = equal_length(xd, yd, zd)
|
154
250
|
inquiry [{ double: nx }, { double: ny }, { double: nx * ny }] do |px, py, pz|
|
@@ -156,24 +252,56 @@ module GR
|
|
156
252
|
end
|
157
253
|
end
|
158
254
|
|
255
|
+
# Specify the line style for polylines.
|
256
|
+
# @param style [Integer] The polyline line style
|
257
|
+
# * 1 : LINETYPE_SOLID
|
258
|
+
# * Solid line
|
259
|
+
# * 2 : LINETYPE_DASHED
|
260
|
+
# * Dashed line
|
261
|
+
# * 3 : LINETYPE_DOTTED
|
262
|
+
# * Dotted line
|
263
|
+
# * 4 : LINETYPE_DASHED_DOTTED
|
264
|
+
# * Dashed-dotted line
|
265
|
+
# * -1 : LINETYPE_DASH_2_DOT
|
266
|
+
# * Sequence of one dash followed by two dots
|
267
|
+
# * -2 : LINETYPE_DASH_3_DOT
|
268
|
+
# * Sequence of one dash followed by three dots
|
269
|
+
# * -3 : LINETYPE_LONG_DASH
|
270
|
+
# * Sequence of long dashes
|
271
|
+
# * -4 : LINETYPE_LONG_SHORT_DASH
|
272
|
+
# * Sequence of a long dash followed by a short dash
|
273
|
+
# * -5 : LINETYPE_SPACED_DASH
|
274
|
+
# * Sequence of dashes double spaced
|
275
|
+
# * -6 : LINETYPE_SPACED_DOT
|
276
|
+
# * Sequence of dots double spaced
|
277
|
+
# * -7 : LINETYPE_DOUBLE_DOT
|
278
|
+
# * Sequence of pairs of dots
|
279
|
+
# * -8 : LINETYPE_TRIPLE_DOT
|
280
|
+
# * Sequence of groups of three dots
|
159
281
|
def setlinetype(*)
|
160
282
|
super
|
161
283
|
end
|
162
284
|
|
163
|
-
# inqlinetype
|
164
285
|
def inqlinetype
|
165
286
|
inquiry_int { |pt| super(pt) }
|
166
287
|
end
|
167
288
|
|
289
|
+
# Define the line width of subsequent polyline output primitives.
|
290
|
+
# @param width [Numeric] The polyline line width scale factor
|
291
|
+
# The line width is calculated as the nominal line width generated
|
292
|
+
# on the workstation multiplied by the line width scale factor.
|
293
|
+
# This value is mapped by the workstation to the nearest available line width.
|
294
|
+
# The default line width is 1.0, or 1 times the line width generated on the graphics device.
|
168
295
|
def setlinewidth(*)
|
169
296
|
super
|
170
297
|
end
|
171
298
|
|
172
|
-
# inqlinewidth
|
173
299
|
def inqlinewidth
|
174
300
|
inquiry_double { |pt| super(pt) }
|
175
301
|
end
|
176
302
|
|
303
|
+
# Define the color of subsequent polyline output primitives.
|
304
|
+
# @param color [Integer] The polyline color index (COLOR < 1256)
|
177
305
|
def setlinecolorind(*)
|
178
306
|
super
|
179
307
|
end
|
@@ -183,37 +311,167 @@ module GR
|
|
183
311
|
inquiry_int { |pt| super(pt) }
|
184
312
|
end
|
185
313
|
|
314
|
+
# Specifiy the marker type for polymarkers.
|
315
|
+
# @param style [Integer] The polymarker marker type
|
316
|
+
# * 1 : MARKERTYPE_DOT
|
317
|
+
# * Smallest displayable dot
|
318
|
+
# * 2 : MARKERTYPE_PLUS
|
319
|
+
# * Plus sign
|
320
|
+
# * 3 : MARKERTYPE_ASTERISK
|
321
|
+
# * Asterisk
|
322
|
+
# * 4 : MARKERTYPE_CIRCLE
|
323
|
+
# * Hollow circle
|
324
|
+
# * 5 : MARKERTYPE_DIAGONAL_CROSS
|
325
|
+
# * Diagonal cross
|
326
|
+
# * -1 : MARKERTYPE_SOLID_CIRCLE
|
327
|
+
# * Filled circle
|
328
|
+
# * -2 : MARKERTYPE_TRIANGLE_UP
|
329
|
+
# * Hollow triangle pointing upward
|
330
|
+
# * -3 : MARKERTYPE_SOLID_TRI_UP
|
331
|
+
# * Filled triangle pointing upward
|
332
|
+
# * -4 : MARKERTYPE_TRIANGLE_DOWN
|
333
|
+
# * Hollow triangle pointing downward
|
334
|
+
# * -5 : MARKERTYPE_SOLID_TRI_DOWN
|
335
|
+
# * Filled triangle pointing downward
|
336
|
+
# * -6 : MARKERTYPE_SQUARE
|
337
|
+
# * Hollow square
|
338
|
+
# * -7 : MARKERTYPE_SOLID_SQUARE
|
339
|
+
# * Filled square
|
340
|
+
# * -8 : MARKERTYPE_BOWTIE
|
341
|
+
# * Hollow bowtie
|
342
|
+
# * -9 : MARKERTYPE_SOLID_BOWTIE
|
343
|
+
# * Filled bowtie
|
344
|
+
# * -10 : MARKERTYPE_HGLASS
|
345
|
+
# * Hollow hourglass
|
346
|
+
# * -11 : MARKERTYPE_SOLID_HGLASS
|
347
|
+
# * Filled hourglass
|
348
|
+
# * -12 : MARKERTYPE_DIAMOND
|
349
|
+
# * Hollow diamond
|
350
|
+
# * -13 : MARKERTYPE_SOLID_DIAMOND
|
351
|
+
# * Filled Diamond
|
352
|
+
# * -14 : MARKERTYPE_STAR
|
353
|
+
# * Hollow star
|
354
|
+
# * -15 : MARKERTYPE_SOLID_STAR
|
355
|
+
# * Filled Star
|
356
|
+
# * -16 : MARKERTYPE_TRI_UP_DOWN
|
357
|
+
# * Hollow triangles pointing up and down overlaid
|
358
|
+
# * -17 : MARKERTYPE_SOLID_TRI_RIGHT
|
359
|
+
# * Filled triangle point right
|
360
|
+
# * -18 : MARKERTYPE_SOLID_TRI_LEFT
|
361
|
+
# * Filled triangle pointing left
|
362
|
+
# * -19 : MARKERTYPE_HOLLOW PLUS
|
363
|
+
# * Hollow plus sign
|
364
|
+
# * -20 : MARKERTYPE_SOLID PLUS
|
365
|
+
# * Solid plus sign
|
366
|
+
# * -21 : MARKERTYPE_PENTAGON
|
367
|
+
# * Pentagon
|
368
|
+
# * -22 : MARKERTYPE_HEXAGON
|
369
|
+
# * Hexagon
|
370
|
+
# * -23 : MARKERTYPE_HEPTAGON
|
371
|
+
# * Heptagon
|
372
|
+
# * -24 : MARKERTYPE_OCTAGON
|
373
|
+
# * Octagon
|
374
|
+
# * -25 : MARKERTYPE_STAR_4
|
375
|
+
# * 4-pointed star
|
376
|
+
# * -26 : MARKERTYPE_STAR_5
|
377
|
+
# * 5-pointed star (pentagram)
|
378
|
+
# * -27 : MARKERTYPE_STAR_6
|
379
|
+
# * 6-pointed star (hexagram)
|
380
|
+
# * -28 : MARKERTYPE_STAR_7
|
381
|
+
# * 7-pointed star (heptagram)
|
382
|
+
# * -29 : MARKERTYPE_STAR_8
|
383
|
+
# * 8-pointed star (octagram)
|
384
|
+
# * -30 : MARKERTYPE_VLINE
|
385
|
+
# * verical line
|
386
|
+
# * -31 : MARKERTYPE_HLINE
|
387
|
+
# * horizontal line
|
388
|
+
# * -32 : MARKERTYPE_OMARK
|
389
|
+
# * o-mark
|
390
|
+
# Polymarkers appear centered over their specified coordinates.
|
186
391
|
def setmarkertype(*)
|
187
392
|
super
|
188
393
|
end
|
189
394
|
|
190
|
-
# inqmarkertype
|
191
395
|
def inqmarkertype
|
192
396
|
inquiry_int { |pt| super(pt) }
|
193
397
|
end
|
194
398
|
|
399
|
+
# Specify the marker size for polymarkers.
|
400
|
+
# @param size [Numeric] Scale factor applied to the nominal marker size
|
401
|
+
# The polymarker size is calculated as the nominal size generated on the graphics device
|
402
|
+
# multiplied by the marker size scale factor.
|
195
403
|
def setmarkersize(*)
|
196
404
|
super
|
197
405
|
end
|
198
406
|
|
199
|
-
#
|
407
|
+
# Inquire the marker size for polymarkers.
|
200
408
|
def inqmarkersize
|
201
409
|
inquiry_double { |pt| super(pt) }
|
202
410
|
end
|
203
411
|
|
412
|
+
# Define the color of subsequent polymarker output primitives.
|
413
|
+
# @param color [Integer] The polymarker color index (COLOR < 1256)
|
204
414
|
def setmarkercolorind(*)
|
205
415
|
super
|
206
416
|
end
|
207
417
|
|
208
|
-
# inqmarkercolorind
|
209
418
|
def inqmarkercolorind
|
210
419
|
inquiry_int { |pt| super(pt) }
|
211
420
|
end
|
212
421
|
|
422
|
+
# Specify the text font and precision for subsequent text output primitives.
|
423
|
+
# @param font [Integer] Text font
|
424
|
+
# * 101 : FONT_TIMES_ROMAN
|
425
|
+
# * 102 : FONT_TIMES_ITALIC
|
426
|
+
# * 103 : FONT_TIMES_BOLD
|
427
|
+
# * 104 : FONT_TIMES_BOLDITALIC
|
428
|
+
# * 105 : FONT_HELVETICA
|
429
|
+
# * 106 : FONT_HELVETICA_OBLIQUE
|
430
|
+
# * 107 : FONT_HELVETICA_BOLD
|
431
|
+
# * 108 : FONT_HELVETICA_BOLDOBLIQUE
|
432
|
+
# * 109 : FONT_COURIER
|
433
|
+
# * 110 : FONT_COURIER_OBLIQUE
|
434
|
+
# * 111 : FONT_COURIER_BOLD
|
435
|
+
# * 112 : FONT_COURIER_BOLDOBLIQUE
|
436
|
+
# * 113 : FONT_SYMBOL
|
437
|
+
# * 114 : FONT_BOOKMAN_LIGHT
|
438
|
+
# * 115 : FONT_BOOKMAN_LIGHTITALIC
|
439
|
+
# * 116 : FONT_BOOKMAN_DEMI
|
440
|
+
# * 117 : FONT_BOOKMAN_DEMIITALIC
|
441
|
+
# * 118 : FONT_NEWCENTURYSCHLBK_ROMAN
|
442
|
+
# * 119 : FONT_NEWCENTURYSCHLBK_ITALIC
|
443
|
+
# * 120 : FONT_NEWCENTURYSCHLBK_BOLD
|
444
|
+
# * 121 : FONT_NEWCENTURYSCHLBK_BOLDITALIC
|
445
|
+
# * 122 : FONT_AVANTGARDE_BOOK
|
446
|
+
# * 123 : FONT_AVANTGARDE_BOOKOBLIQUE
|
447
|
+
# * 124 : FONT_AVANTGARDE_DEMI
|
448
|
+
# * 125 : FONT_AVANTGARDE_DEMIOBLIQUE
|
449
|
+
# * 126 : FONT_PALATINO_ROMAN
|
450
|
+
# * 127 : FONT_PALATINO_ITALIC
|
451
|
+
# * 128 : FONT_PALATINO_BOLD
|
452
|
+
# * 129 : FONT_PALATINO_BOLDITALIC
|
453
|
+
# * 130 : FONT_ZAPFCHANCERY_MEDIUMITALIC
|
454
|
+
# * 131 : FONT_ZAPFDINGBATS
|
455
|
+
# @param precision [Integer] Text precision
|
456
|
+
# * 0 : TEXT_PRECISION_STRING
|
457
|
+
# * String precision (higher quality)
|
458
|
+
# * 1 : TEXT_PRECISION_CHAR
|
459
|
+
# * Character precision (medium quality)
|
460
|
+
# * 2 : TEXT_PRECISION_STROKE
|
461
|
+
# * Stroke precision (lower quality)
|
462
|
+
# The appearance of a font depends on the text precision value specified.
|
463
|
+
# STRING, CHARACTER or STROKE precision allows for a greater or lesser
|
464
|
+
# realization of the text primitives, for efficiency. STRING is the default
|
465
|
+
# precision for GR and produces the highest quality output.
|
213
466
|
def settextfontprec(*)
|
214
467
|
super
|
215
468
|
end
|
216
469
|
|
470
|
+
# Set the current character expansion factor (width to height ratio).
|
471
|
+
# @param factor [Numeric] Text expansion factor applied to the nominal text width-to-height ratio
|
472
|
+
# `setcharexpan` defines the width of subsequent text output primitives. The expansion
|
473
|
+
# factor alters the width of the generated characters, but not their height. The default
|
474
|
+
# text expansion factor is 1, or one times the normal width-to-height ratio of the text.
|
217
475
|
def setcharexpan(*)
|
218
476
|
super
|
219
477
|
end
|
@@ -222,57 +480,157 @@ module GR
|
|
222
480
|
super
|
223
481
|
end
|
224
482
|
|
483
|
+
# Sets the current text color index.
|
484
|
+
# @param color [Integer] The text color index (COLOR < 1256)
|
485
|
+
# `settextcolorind` defines the color of subsequent text output primitives.
|
486
|
+
# GR uses the default foreground color (black=1) for the default text color index.
|
225
487
|
def settextcolorind(*)
|
226
488
|
super
|
227
489
|
end
|
228
490
|
|
491
|
+
# Set the current character height.
|
492
|
+
# @param height [Numeric] Text height value
|
493
|
+
# `setcharheight` defines the height of subsequent text output primitives. Text height
|
494
|
+
# is defined as a percentage of the default window. GR uses the default text height of
|
495
|
+
# 0.027 (2.7% of the height of the default window).
|
229
496
|
def setcharheight(*)
|
230
497
|
super
|
231
498
|
end
|
232
499
|
|
500
|
+
# Set the current character text angle up vector.
|
501
|
+
# @param ux [Numeric] Text up vector
|
502
|
+
# @param uy [Numeric] Text up vector
|
503
|
+
# `setcharup` defines the vertical rotation of subsequent text output primitives.
|
504
|
+
# The text up vector is initially set to (0, 1), horizontal to the baseline.
|
233
505
|
def setcharup(*)
|
234
506
|
super
|
235
507
|
end
|
236
508
|
|
509
|
+
# Define the current direction in which subsequent text will be drawn.
|
510
|
+
# @param path [Integer] Text path
|
511
|
+
# * 0 : TEXT_PATH_RIGHT
|
512
|
+
# * left-to-right
|
513
|
+
# * 1 : TEXT_PATH_LEFT
|
514
|
+
# * right-to-left
|
515
|
+
# * 2 : TEXT_PATH_UP
|
516
|
+
# * downside-up
|
517
|
+
# * 3 : TEXT_PATH_DOWN
|
518
|
+
# * upside-down
|
237
519
|
def settextpath(*)
|
238
520
|
super
|
239
521
|
end
|
240
522
|
|
523
|
+
# Set the current horizontal and vertical alignment for text.
|
524
|
+
# @param horizontal [Integer] Horizontal text alignment
|
525
|
+
# * 0 : TEXT_HALIGN_NORMAL
|
526
|
+
# * 1 : TEXT_HALIGN_LEFT
|
527
|
+
# * Left justify
|
528
|
+
# * 2 : TEXT_HALIGN_CENTER
|
529
|
+
# * Center justify
|
530
|
+
# * 3 : TEXT_HALIGN_RIGHT
|
531
|
+
# * Right justify
|
532
|
+
# @param vertical [Integer] Vertical text alignment
|
533
|
+
# * 0 : TEXT_VALIGN_NORMAL
|
534
|
+
# * 1 : TEXT_VALIGN_TOP
|
535
|
+
# * Align with the top of the characters
|
536
|
+
# * 2 : TEXT_VALIGN_CAP
|
537
|
+
# * Aligned with the cap of the characters
|
538
|
+
# * 3 : TEXT_VALIGN_HALF
|
539
|
+
# * Aligned with the half line of the characters
|
540
|
+
# * 4 : TEXT_VALIGN_BASE
|
541
|
+
# * Aligned with the base line of the characters
|
542
|
+
# * 5 : TEXT_VALIGN_BOTTOM
|
543
|
+
# * Aligned with the bottom line of the characters
|
544
|
+
# `settextalign` specifies how the characters in a text primitive will be aligned
|
545
|
+
# in horizontal and vertical space. The default text alignment indicates horizontal left
|
546
|
+
# alignment and vertical baseline alignment.
|
241
547
|
def settextalign(*)
|
242
548
|
super
|
243
549
|
end
|
244
550
|
|
551
|
+
# Set the fill area interior style to be used for fill areas.
|
552
|
+
# @param style [Integer] The style of fill to be used
|
553
|
+
# * 0 : HOLLOW
|
554
|
+
# * No filling. Just draw the bounding polyline
|
555
|
+
# * 1 : SOLID
|
556
|
+
# * Fill the interior of the polygon using the fill color index
|
557
|
+
# * 2 : PATTERN
|
558
|
+
# * Fill the interior of the polygon using the style index as a pattern index
|
559
|
+
# * 3 : HATCH
|
560
|
+
# * Fill the interior of the polygon using the style index as a cross-hatched style
|
561
|
+
# `setfillintstyle` defines the interior style for subsequent fill area output
|
562
|
+
# primitives. The default interior style is HOLLOW.
|
245
563
|
def setfillintstyle(*)
|
246
564
|
super
|
247
565
|
end
|
248
566
|
|
249
|
-
#
|
567
|
+
# Returns the fill area interior style to be used for fill areas.
|
250
568
|
def inqfillintstyle
|
251
569
|
inquiry_int { |pt| super(pt) }
|
252
570
|
end
|
253
571
|
|
572
|
+
# Sets the fill style to be used for subsequent fill areas.
|
573
|
+
# @param index [Integer] The fill style index to be used
|
574
|
+
# `setfillstyle` specifies an index when PATTERN fill or HATCH fill is requested by the
|
575
|
+
# `setfillintstyle` function. If the interior style is set to PATTERN, the fill style
|
576
|
+
# index points to a device-independent pattern table. If interior style is set to HATCH
|
577
|
+
# the fill style index indicates different hatch styles. If HOLLOW or SOLID is specified
|
578
|
+
# for the interior style, the fill style index is unused.
|
254
579
|
def setfillstyle(*)
|
255
580
|
super
|
256
581
|
end
|
257
582
|
|
258
|
-
#
|
583
|
+
# Returns the current fill area color index.
|
259
584
|
def inqfillstyle
|
260
585
|
inquiry_int { |pt| super(pt) }
|
261
586
|
end
|
262
587
|
|
588
|
+
# Sets the current fill area color index.
|
589
|
+
# @param color [Integer] The text color index (COLOR < 1256)
|
590
|
+
# `setfillcolorind` defines the color of subsequent fill area output primitives.
|
591
|
+
# GR uses the default foreground color (black=1) for the default fill area color index.
|
263
592
|
def setfillcolorind(*)
|
264
593
|
super
|
265
594
|
end
|
266
595
|
|
267
|
-
#
|
596
|
+
# Returns the current fill area color index.
|
268
597
|
def inqfillcolorind
|
269
598
|
inquiry_int { |pt| super(pt) }
|
270
599
|
end
|
271
600
|
|
601
|
+
# `setcolorrep` allows to redefine an existing color index representation by specifying
|
602
|
+
# an RGB color triplet.
|
603
|
+
# @param index [Integer] Color index in the range 0 to 1256
|
604
|
+
# @param red [Numeric] Red intensity in the range 0.0 to 1.0
|
605
|
+
# @param green [Numeric] Green intensity in the range 0.0 to 1.0
|
606
|
+
# @param blue [Numeric] Blue intensity in the range 0.0 to 1.0
|
272
607
|
def setcolorrep(*)
|
273
608
|
super
|
274
609
|
end
|
275
610
|
|
611
|
+
# `setscale` sets the type of transformation to be used for subsequent GR output
|
612
|
+
# primitives.
|
613
|
+
# @param options [Integer] Scale specification
|
614
|
+
# * 1 : OPTION_X_LOG
|
615
|
+
# * Logarithmic X-axis
|
616
|
+
# * 2 : OPTION_Y_LOG
|
617
|
+
# * Logarithmic Y-axis
|
618
|
+
# * 4 : OPTION_Z_LOG
|
619
|
+
# * Logarithmic Z-axis
|
620
|
+
# * 8 : OPTION_FLIP_X
|
621
|
+
# * Flip X-axis
|
622
|
+
# * 16 : OPTION_FLIP_Y
|
623
|
+
# * Flip Y-axis
|
624
|
+
# * 32 : OPTION_FLIP_Z
|
625
|
+
# * Flip Z-axis
|
626
|
+
# `setscale` defines the current transformation according to the given scale
|
627
|
+
# specification which may be or'ed together using any of the above options. GR uses
|
628
|
+
# these options for all subsequent output primitives until another value is provided.
|
629
|
+
# The scale options are used to transform points from an abstract logarithmic or
|
630
|
+
# semi-logarithmic coordinate system, which may be flipped along each axis, into the
|
631
|
+
# world coordinate system.
|
632
|
+
# Note: When applying a logarithmic transformation to a specific axis, the system
|
633
|
+
# assumes that the axes limits are greater than zero.
|
276
634
|
def setscale(*)
|
277
635
|
super
|
278
636
|
end
|
@@ -282,6 +640,19 @@ module GR
|
|
282
640
|
inquiry_int { |pt| super(pt) }
|
283
641
|
end
|
284
642
|
|
643
|
+
# `setwindow` establishes a window, or rectangular subspace, of world coordinates to be
|
644
|
+
# plotted. If you desire log scaling or mirror-imaging of axes, use the SETSCALE function.
|
645
|
+
# @param xmin [Numeric] The left horizontal coordinate of the window (`xmin` < `xmax`).
|
646
|
+
# @param xmax [Numeric] The right horizontal coordinate of the window.
|
647
|
+
# @param ymin [Numeric] The bottom vertical coordinate of the window (`ymin` < `ymax`).
|
648
|
+
# @param ymax [Numeric] The top vertical coordinate of the window.
|
649
|
+
# `setwindow` defines the rectangular portion of the World Coordinate space (WC) to be
|
650
|
+
# associated with the specified normalization transformation. The WC window and the
|
651
|
+
# Normalized Device Coordinates (NDC) viewport define the normalization transformation
|
652
|
+
# through which all output primitives are mapped. The WC window is mapped onto the
|
653
|
+
# rectangular NDC viewport which is, in turn, mapped onto the display surface of the
|
654
|
+
# open and active workstation, in device coordinates. By default, GR uses the range
|
655
|
+
# \[0,1] x [0,1], in world coordinates, as the normalization transformation window.
|
285
656
|
def setwindow(*)
|
286
657
|
super
|
287
658
|
end
|
@@ -293,6 +664,17 @@ module GR
|
|
293
664
|
end
|
294
665
|
end
|
295
666
|
|
667
|
+
# `setviewport` establishes a rectangular subspace of normalized device coordinates.
|
668
|
+
# @param xmin [Numeric] The left horizontal coordinate of the viewport.
|
669
|
+
# @param xmax [Numeric] The right horizontal coordinate of the viewport (0 <= `xmin` < `xmax` <= 1).
|
670
|
+
# @param ymin [Numeric] The bottom vertical coordinate of the viewport.
|
671
|
+
# @param ymax [Numeric] The top vertical coordinate of the viewport (0 <= `ymin` < `ymax` <= 1).
|
672
|
+
# `setviewport` defines the rectangular portion of the Normalized Device Coordinate
|
673
|
+
# (NDC) space to be associated with the specified normalization transformation. The
|
674
|
+
# NDC viewport and World Coordinate (WC) window define the normalization transformation
|
675
|
+
# through which all output primitives pass. The WC window is mapped onto the rectangular
|
676
|
+
# NDC viewport which is, in turn, mapped onto the display surface of the open and active
|
677
|
+
# workstation, in device coordinates.
|
296
678
|
def setviewport(*)
|
297
679
|
super
|
298
680
|
end
|
@@ -304,18 +686,51 @@ module GR
|
|
304
686
|
end
|
305
687
|
end
|
306
688
|
|
689
|
+
# `selntran` selects a predefined transformation from world coordinates to normalized
|
690
|
+
# device coordinates.
|
691
|
+
# @param transform [Integer] A normalization transformation number.
|
692
|
+
# * 0 : Selects the identity transformation in which both the window and viewport have the range of 0 to 1
|
693
|
+
# * >= 1 : Selects a normalization transformation as defined by `setwindow` and `setviewport`
|
307
694
|
def selntran(*)
|
308
695
|
super
|
309
696
|
end
|
310
697
|
|
698
|
+
# Set the clipping indicator.
|
699
|
+
# @params indicator [Integer] An indicator specifying whether clipping is on or off.
|
700
|
+
# * 0 : Clipping is off. Data outside of the window will be drawn.
|
701
|
+
# * 1 : Clipping is on. Data outside of the window will not be drawn.
|
702
|
+
# `setclip` enables or disables clipping of the image drawn in the current window.
|
703
|
+
# Clipping is defined as the removal of those portions of the graph that lie outside of
|
704
|
+
# the defined viewport. If clipping is on, GR does not draw generated output primitives
|
705
|
+
# past the viewport boundaries. If clipping is off, primitives may exceed the viewport
|
706
|
+
# boundaries, and they will be drawn to the edge of the workstation window.
|
707
|
+
# By default, clipping is on.
|
311
708
|
def setclip(*)
|
312
709
|
super
|
313
710
|
end
|
314
711
|
|
712
|
+
# Set the area of the NDC viewport that is to be drawn in the workstation window.
|
713
|
+
# @param xmin [Numeric] The left horizontal coordinate of the workstation window.
|
714
|
+
# @param xmax [Numeric] The right horizontal coordinate of the workstation window (0 <= `xmin` < `xmax` <= 1).
|
715
|
+
# @param ymin [Numeric] The bottom vertical coordinate of the workstation window.
|
716
|
+
# @param ymax [Numeric] The top vertical coordinate of the workstation window (0 <= `ymin` < `ymax` <= 1).
|
717
|
+
# `setwswindow` defines the rectangular area of the Normalized Device Coordinate space
|
718
|
+
# to be output to the device. By default, the workstation transformation will map the
|
719
|
+
# range [0,1] x [0,1] in NDC onto the largest square on the workstation’s display
|
720
|
+
# surface. The aspect ratio of the workstation window is maintained at 1 to 1.
|
315
721
|
def setwswindow(*)
|
316
722
|
super
|
317
723
|
end
|
318
724
|
|
725
|
+
# Define the size of the workstation graphics window in meters.
|
726
|
+
# @param xmin [Numeric] The left horizontal coordinate of the workstation viewport.
|
727
|
+
# @param xmax [Numeric] The right horizontal coordinate of the workstation viewport.
|
728
|
+
# @param ymin [Numeric] The bottom vertical coordinate of the workstation viewport.
|
729
|
+
# @param ymax [Numeric] The top vertical coordinate of the workstation viewport.
|
730
|
+
# `setwsviewport` places a workstation window on the display of the specified size in
|
731
|
+
# meters. This command allows the workstation window to be accurately sized for a
|
732
|
+
# display or hardcopy device, and is often useful for sizing graphs for desktop
|
733
|
+
# publishing applications.
|
319
734
|
def setwsviewport(*)
|
320
735
|
super
|
321
736
|
end
|
@@ -348,17 +763,79 @@ module GR
|
|
348
763
|
super
|
349
764
|
end
|
350
765
|
|
766
|
+
# Set the abstract Z-space used for mapping three-dimensional output primitives into
|
767
|
+
# the current world coordinate space.
|
768
|
+
# @param zmin [Numeric] Minimum value for the Z-axis.
|
769
|
+
# @param zmax [Numeric] Maximum value for the Z-axis.
|
770
|
+
# @param rotation [Integer] Angle for the rotation of the X axis, in degrees.
|
771
|
+
# @param tilt [integer] Viewing angle of the Z axis in degrees.
|
772
|
+
# `setspace` establishes the limits of an abstract Z-axis and defines the angles for
|
773
|
+
# rotation and for the viewing angle (tilt) of a simulated three-dimensional graph,
|
774
|
+
# used for mapping corresponding output primitives into the current window.
|
775
|
+
# These settings are used for all subsequent three-dimensional output primitives until
|
776
|
+
# other values are specified. Angles of rotation and viewing angle must be specified
|
777
|
+
# between 0° and 90°.
|
351
778
|
def setspace(*)
|
352
779
|
super
|
353
780
|
end
|
354
781
|
|
355
|
-
# inqspace
|
356
782
|
def inqspace
|
357
783
|
inquiry %i[double double int int] do |*pts|
|
358
784
|
super(*pts)
|
359
785
|
end
|
360
786
|
end
|
361
787
|
|
788
|
+
# Draw a text at position `x`, `y` using the current text attributes. Strings can be
|
789
|
+
# defined to create basic mathematical expressions and Greek letters.
|
790
|
+
# @param x [Numeric] The X coordinate of starting position of the text string
|
791
|
+
# @param y [Numeric] The Y coordinate of starting position of the text string
|
792
|
+
# @param string [String] The text to be drawn
|
793
|
+
#
|
794
|
+
# The values for X and Y are in normalized device coordinates.
|
795
|
+
# The attributes that control the appearance of text are text font and precision,
|
796
|
+
# character expansion factor, character spacing, text color index, character
|
797
|
+
# height, character up vector, text path and text alignment.
|
798
|
+
#
|
799
|
+
# The character string is interpreted to be a simple mathematical formula.
|
800
|
+
# The following notations apply:
|
801
|
+
#
|
802
|
+
# Subscripts and superscripts: These are indicated by carets ('^') and underscores
|
803
|
+
# \('_'). If the sub/superscript contains more than one character, it must be enclosed
|
804
|
+
# in curly braces ('{}').
|
805
|
+
#
|
806
|
+
# Fractions are typeset with A '/' B, where A stands for the numerator and B for the
|
807
|
+
# denominator.
|
808
|
+
#
|
809
|
+
# To include a Greek letter you must specify the corresponding keyword after a
|
810
|
+
# backslash ('\') character. The text translator produces uppercase or lowercase
|
811
|
+
# Greek letters depending on the case of the keyword.
|
812
|
+
# * Α α - alpha
|
813
|
+
# * Β β - beta
|
814
|
+
# * Γ γ - gamma
|
815
|
+
# * Δ δ - delta
|
816
|
+
# * Ε ε - epsilon
|
817
|
+
# * Ζ ζ - zeta
|
818
|
+
# * Η η - eta
|
819
|
+
# * Θ θ - theta
|
820
|
+
# * Ι ι - iota
|
821
|
+
# * Κ κ - kappa
|
822
|
+
# * Λ λ - lambda
|
823
|
+
# * Μ μ - mu
|
824
|
+
# * Ν ν - Nu / v
|
825
|
+
# * Ξ ξ - xi
|
826
|
+
# * Ο ο - omicron
|
827
|
+
# * Π π - pi
|
828
|
+
# * Ρ ρ - rho
|
829
|
+
# * Σ σ - sigma
|
830
|
+
# * Τ τ - tau
|
831
|
+
# * Υ υ - upsilon
|
832
|
+
# * Φ φ - phi
|
833
|
+
# * Χ χ - chi
|
834
|
+
# * Ψ ψ - psi
|
835
|
+
# * Ω ω - omega
|
836
|
+
# Note: `\v` is a replacement for `\nu` which would conflict with `\n` (newline)
|
837
|
+
# For more sophisticated mathematical formulas, you should use the `gr.mathtex`
|
838
|
+
# function.
|
362
839
|
def textext(*)
|
363
840
|
super
|
364
841
|
end
|
@@ -370,27 +847,88 @@ module GR
|
|
370
847
|
end
|
371
848
|
end
|
372
849
|
|
850
|
+
# Draw X and Y coordinate axes with linearly and/or logarithmically spaced tick marks.
|
851
|
+
# @param x_tick [Numeric] The interval between minor tick marks on the X axis.
|
852
|
+
# @param y_tick [Numeric] The interval between minor tick marks on the Y axis.
|
853
|
+
# @param x_org [Numeric] The world coordinates of the origin (point of intersection) of the X axis.
|
854
|
+
# @param y_org [Numeric] The world coordinates of the origin (point of intersection) of the Y axis.
|
855
|
+
# @param major_x [Integer]
|
856
|
+
# Unitless integer values specifying the number of minor tick intervals
|
857
|
+
# between major tick marks. Values of 0 or 1 imply no minor ticks.
|
858
|
+
# Negative values specify no labels will be drawn for the associated axis.
|
859
|
+
# @param major_y [Integer]
|
860
|
+
# Unitless integer values specifying the number of minor tick intervals
|
861
|
+
# between major tick marks. Values of 0 or 1 imply no minor ticks.
|
862
|
+
# Negative values specify no labels will be drawn for the associated axis.
|
863
|
+
# @param tick_size [Numeric]
|
864
|
+
# The length of minor tick marks specified in a normalized device
|
865
|
+
# coordinate unit. Major tick marks are twice as long as minor tick marks.
|
866
|
+
# A negative value reverses the tick marks on the axes from inward facing
|
867
|
+
# to outward facing (or vice versa).
|
373
868
|
def axes(*)
|
374
869
|
super
|
375
870
|
end
|
376
871
|
|
377
872
|
alias axes2d axes
|
378
873
|
|
874
|
+
# Draw a linear and/or logarithmic grid.
|
875
|
+
# @param x_tick [Numeric] The length in world coordinates of the interval between minor grid lines.
|
876
|
+
# @param y_tick [Numeric] The length in world coordinates of the interval between minor grid lines.
|
877
|
+
# @param x_org [Numeric] The world coordinates of the origin (point of intersection) of the grid.
|
878
|
+
# @param y_org [Numeric] The world coordinates of the origin (point of intersection) of the grid.
|
879
|
+
# @param major_x [Integer]
|
880
|
+
# Unitless integer values specifying the number of minor grid lines
|
881
|
+
# between major grid lines. Values of 0 or 1 imply no grid lines.
|
882
|
+
# @param major_y [Integer]
|
883
|
+
# Unitless integer values specifying the number of minor grid lines
|
884
|
+
# between major grid lines. Values of 0 or 1 imply no grid lines.
|
885
|
+
#
|
886
|
+
# Major grid lines correspond to the axes origin and major tick marks whether visible
|
887
|
+
# or not. Minor grid lines are drawn at points equal to minor tick marks. Major grid
|
888
|
+
# lines are drawn using black lines and minor grid lines are drawn using gray lines.
|
379
889
|
def grid(*)
|
380
890
|
super
|
381
891
|
end
|
382
892
|
|
893
|
+
# Draw a linear and/or logarithmic grid.
|
894
|
+
# @param x_tick [Numeric] The length in world coordinates of the interval between minor grid lines.
|
895
|
+
# @param y_tick [Numeric] The length in world coordinates of the interval between minor grid lines.
|
896
|
+
# @param z_tick [Numeric] The length in world coordinates of the interval between minor grid lines.
|
897
|
+
# @param x_org [Numeric] The world coordinates of the origin (point of intersection) of the grid.
|
898
|
+
# @param y_org [Numeric] The world coordinates of the origin (point of intersection) of the grid.
|
899
|
+
# @param z_org [Numeric] The world coordinates of the origin (point of intersection) of the grid.
|
900
|
+
# @param major_x [Integer]
|
901
|
+
# Unitless integer values specifying the number of minor grid lines
|
902
|
+
# between major grid lines. Values of 0 or 1 imply no grid lines.
|
903
|
+
# @param major_y [Integer]
|
904
|
+
# Unitless integer values specifying the number of minor grid lines
|
905
|
+
# between major grid lines. Values of 0 or 1 imply no grid lines.
|
906
|
+
# @param major_z [Integer]
|
907
|
+
# Unitless integer values specifying the number of minor grid lines
|
908
|
+
# between major grid lines. Values of 0 or 1 imply no grid lines.
|
909
|
+
#
|
910
|
+
# Major grid lines correspond to the axes origin and major tick marks whether visible
|
911
|
+
# or not. Minor grid lines are drawn at points equal to minor tick marks. Major grid
|
912
|
+
# lines are drawn using black lines and minor grid lines are drawn using gray lines.
|
383
913
|
def grid3d(*)
|
384
914
|
super
|
385
915
|
end
|
386
916
|
|
387
917
|
# Draw a standard vertical error bar graph.
|
918
|
+
# @param x [Array, NArray] A list of length N containing the X coordinates
|
919
|
+
# @param y [Array, NArray] A list of length N containing the Y coordinates
|
920
|
+
# @param e1 [Array, NArray] The absolute values of the lower error bar data
|
921
|
+
# @param e2 [Array, NArray] The absolute values of the lower error bar data
|
388
922
|
def verrorbars(px, py, e1, e2)
|
389
923
|
n = equal_length(px, py, e1, e2)
|
390
924
|
super(n, px, py, e1, e2)
|
391
925
|
end
|
392
926
|
|
393
927
|
# Draw a standard horizontal error bar graph.
|
928
|
+
# @param x [Array, NArray] A list of length N containing the X coordinates
|
929
|
+
# @param y [Array, NArray] A list of length N containing the Y coordinates
|
930
|
+
# @param e1 [Array, NArray] The absolute values of the lower error bar data
|
931
|
+
# @param e2 [Array, NArray] The absolute values of the lower error bar data
|
394
932
|
def herrorbars(px, py, e1, e2)
|
395
933
|
n = equal_length(px, py, e1, e2)
|
396
934
|
super(n, px, py, e1, e2)
|
@@ -398,26 +936,96 @@ module GR
|
|
398
936
|
|
399
937
|
# Draw a 3D curve using the current line attributes,
|
400
938
|
# starting from the first data point and ending at the last data point.
|
939
|
+
# @param x [Array, NArray] A list of length N containing the X coordinates
|
940
|
+
# @param y [Array, NArray] A list of length N containing the Y coordinates
|
941
|
+
# @param z [Array, NArray] A list of length N containing the Z coordinates
|
942
|
+
# The values for `x`, `y` and `z` are in world coordinates. The attributes that
|
943
|
+
# control the appearance of a polyline are linetype, linewidth and color
|
944
|
+
# index.
|
401
945
|
def polyline3d(px, py, pz)
|
402
946
|
n = equal_length(px, py, pz)
|
403
947
|
super(n, px, py, pz)
|
404
948
|
end
|
405
949
|
|
406
950
|
# Draw marker symbols centered at the given 3D data points.
|
951
|
+
# @param x [Array, NArray] A list of length N containing the X coordinates
|
952
|
+
# @param y [Array, NArray] A list of length N containing the Y coordinates
|
953
|
+
# @param z [Array, NArray] A list of length N containing the Z coordinates
|
954
|
+
# The values for `x`, `y` and `z` are in world coordinates. The attributes
|
955
|
+
# that control the appearance of a polymarker are marker type, marker size
|
956
|
+
# scale factor and color index.
|
407
957
|
def polymarker3d(px, py, pz)
|
408
958
|
n = equal_length(px, py, pz)
|
409
959
|
super(n, px, py, pz)
|
410
960
|
end
|
411
961
|
|
962
|
+
# Draw X, Y and Z coordinate axes with linearly and/or logarithmically
|
963
|
+
# spaced tick marks.
|
964
|
+
# @param x_tick [Numeric] The interval between minor tick marks on the X axis.
|
965
|
+
# @param y_tick [Numeric] The interval between minor tick marks on the Y axis.
|
966
|
+
# @param z_tick [Numeric] The interval between minor tick marks on the Z axis.
|
967
|
+
# @param x_org [Numeric] The world coordinates of the origin (point of intersection) of the X axes.
|
968
|
+
# @param y_org [Numeric] The world coordinates of the origin (point of intersection) of the Y axes.
|
969
|
+
# @param z_org [Numeric] The world coordinates of the origin (point of intersection) of the Z axes.
|
970
|
+
# @param major_x [Integer]
|
971
|
+
# Unitless integer values specifying the number of minor tick intervals
|
972
|
+
# between major tick marks. Values of 0 or 1 imply no minor ticks.
|
973
|
+
# Negative values specify no labels will be drawn for the associated axis.
|
974
|
+
# @param major_y [Integer]
|
975
|
+
# Unitless integer values specifying the number of minor tick intervals
|
976
|
+
# between major tick marks. Values of 0 or 1 imply no minor ticks.
|
977
|
+
# Negative values specify no labels will be drawn for the associated axis.
|
978
|
+
# @param major_z [Integer]
|
979
|
+
# Unitless integer values specifying the number of minor tick intervals
|
980
|
+
# between major tick marks. Values of 0 or 1 imply no minor ticks.
|
981
|
+
# Negative values specify no labels will be drawn for the associated axis.
|
982
|
+
# @param [Numeric] tick_size
|
983
|
+
# The length of minor tick marks specified in a normalized device
|
984
|
+
# coordinate unit. Major tick marks are twice as long as minor tick marks.
|
985
|
+
# A negative value reverses the tick marks on the axes from inward facing
|
986
|
+
# to outward facing (or vice versa).
|
987
|
+
# Tick marks are positioned along each axis so that major tick marks fall on the axes
|
988
|
+
# origin (whether visible or not). Major tick marks are labeled with the corresponding
|
989
|
+
# data values. Axes are drawn according to the scale of the window. Axes and tick marks
|
990
|
+
# are drawn using solid lines; line color and width can be modified using the
|
991
|
+
# `setlinetype` and `setlinewidth` functions. Axes are drawn according to
|
992
|
+
# the linear or logarithmic transformation established by the `setscale` function.
|
412
993
|
def axes3d(*)
|
413
994
|
super
|
414
995
|
end
|
415
996
|
|
997
|
+
# Display axis titles just outside of their respective axes.
|
998
|
+
# @param x_title [String] The text to be displayed on the X axis
|
999
|
+
# @param x_title [String] The text to be displayed on the Y axis
|
1000
|
+
# @param x_title [String] The text to be displayed on the Z axis
|
416
1001
|
def titles3d(*)
|
417
1002
|
super
|
418
1003
|
end
|
419
1004
|
|
420
1005
|
# Draw a three-dimensional surface plot for the given data points.
|
1006
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
1007
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
1008
|
+
# @param z [Array, NArray]
|
1009
|
+
# A list of length `len(x)` * `len(y)` or an appropriately dimensioned
|
1010
|
+
# array containing the Z coordinates
|
1011
|
+
# @param option [Integer] Surface display option
|
1012
|
+
# * 0 LINES
|
1013
|
+
# * Use X Y polylines to denote the surface
|
1014
|
+
# * 1 MESH
|
1015
|
+
# * Use a wire grid to denote the surface
|
1016
|
+
# * 2 FILLED_MESH
|
1017
|
+
# * Applies an opaque grid to the surface
|
1018
|
+
# * 3 Z_SHADED_MESH
|
1019
|
+
# * Applies Z-value shading to the surface
|
1020
|
+
# * 4 COLORED_MESH
|
1021
|
+
# * Applies a colored grid to the surface
|
1022
|
+
# * 5 CELL_ARRAY
|
1023
|
+
# * Applies a grid of individually-colored cells to the surface
|
1024
|
+
# * 6 SHADED_MESH
|
1025
|
+
# * Applies light source shading to the 3-D surface
|
1026
|
+
# `x` and `y` define a grid. `z` is a singly dimensioned array containing at least
|
1027
|
+
# `nx` * `ny` data points. Z describes the surface height at each point on the grid.
|
1028
|
+
# Data is ordered as shown in the table:
|
421
1029
|
def surface(px, py, pz, option)
|
422
1030
|
# TODO: check: Arrays have incorrect length or dimension.
|
423
1031
|
nx = px.length
|
@@ -428,6 +1036,18 @@ module GR
|
|
428
1036
|
# Draw contours of a three-dimensional data set
|
429
1037
|
# whose values are specified over a rectangular mesh.
|
430
1038
|
# Contour lines may optionally be labeled.
|
1039
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
1040
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
1041
|
+
# @param h [Array, NArray] A list containing the Z coordinate for the height values
|
1042
|
+
# @param z [Array, NArray]
|
1043
|
+
# A list containing the Z coordinate for the height values
|
1044
|
+
# A list of length `len(x)` * `len(y)` or an appropriately dimensioned
|
1045
|
+
# array containing the Z coordinates
|
1046
|
+
# @param major_h [Integer]
|
1047
|
+
# Directs GR to label contour lines. For example, a value of 3 would label
|
1048
|
+
# every third line. A value of 1 will label every line. A value of 0
|
1049
|
+
# produces no labels. To produce colored contour lines, add an offset
|
1050
|
+
# of 1000 to `major_h`.
|
431
1051
|
def contour(px, py, h, pz, major_h)
|
432
1052
|
# TODO: check: Arrays have incorrect length or dimension.
|
433
1053
|
nx = px.length
|
@@ -438,6 +1058,15 @@ module GR
|
|
438
1058
|
|
439
1059
|
# Draw filled contours of a three-dimensional data set
|
440
1060
|
# whose values are specified over a rectangular mesh.
|
1061
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
1062
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
1063
|
+
# @param h [Array, NArray]
|
1064
|
+
# A list containing the Z coordinate for the height values or the number
|
1065
|
+
# of contour lines which will be evenly distributed between minimum and
|
1066
|
+
# maximum Z value
|
1067
|
+
# @param z [Array, NArray]
|
1068
|
+
# A list of length `len(x)` * `len(y)` or an appropriately dimensioned
|
1069
|
+
# array containing the Z coordinates
|
441
1070
|
def contourf(px, py, h, pz, major_h)
|
442
1071
|
# TODO: check: Arrays have incorrect length or dimension.
|
443
1072
|
nx = px.length
|
@@ -453,7 +1082,6 @@ module GR
|
|
453
1082
|
super(npoints, x, y, z, nlevels, levels)
|
454
1083
|
end
|
455
1084
|
|
456
|
-
# hexbin
|
457
1085
|
def hexbin(x, y, nbins)
|
458
1086
|
n = x.length
|
459
1087
|
super(n, x, y, nbins)
|
@@ -468,7 +1096,7 @@ module GR
|
|
468
1096
|
inquiry_int { |pt| super(pt) }
|
469
1097
|
end
|
470
1098
|
|
471
|
-
#
|
1099
|
+
# TODO: GR.jl python-gr different API
|
472
1100
|
def setcolormapfromrgb(r, g, b, positions: nil)
|
473
1101
|
n = equal_length(r, g, b)
|
474
1102
|
if positions.nil?
|
@@ -483,7 +1111,6 @@ module GR
|
|
483
1111
|
super
|
484
1112
|
end
|
485
1113
|
|
486
|
-
# inqcolor
|
487
1114
|
def inqcolor(color)
|
488
1115
|
inquiry_int do |rgb|
|
489
1116
|
super(color, rgb)
|
@@ -494,7 +1121,6 @@ module GR
|
|
494
1121
|
super
|
495
1122
|
end
|
496
1123
|
|
497
|
-
# hsvtorgb
|
498
1124
|
def hsvtorgb(h, s, v)
|
499
1125
|
inquiry %i[double double double] do |r, g, b|
|
500
1126
|
super(h, s, v, r, g, b)
|
@@ -517,10 +1143,60 @@ module GR
|
|
517
1143
|
super
|
518
1144
|
end
|
519
1145
|
|
1146
|
+
# Open and activate a print device.
|
1147
|
+
# @param pathname [String] Filename for the print device.
|
1148
|
+
# The following file types are supported:
|
1149
|
+
# * .ps, .eps : PostScript
|
1150
|
+
# * .pdf : Portable Document Format
|
1151
|
+
# * .bmp : Windows Bitmap (BMP)
|
1152
|
+
# * .jpeg, .jpg : JPEG image file
|
1153
|
+
# * .png : Portable Network Graphics file (PNG)
|
1154
|
+
# * .tiff, .tif : Tagged Image File Format (TIFF)
|
1155
|
+
# * .fig : Xfig vector graphics file
|
1156
|
+
# * .svg : Scalable Vector Graphics
|
1157
|
+
# * .wmf : Windows Metafile
|
1158
|
+
# `beginprint` opens an additional graphics output device. The device type is obtained
|
1159
|
+
# from the given file extension.
|
520
1160
|
def beginprint(*)
|
521
1161
|
super
|
522
1162
|
end
|
523
1163
|
|
1164
|
+
# Open and activate a print device with the given layout attributes.
|
1165
|
+
# @param pathname [String] Filename for the print device.
|
1166
|
+
# @param mode [String] Output mode (Color, GrayScale)
|
1167
|
+
# @param fmt [String] Output format
|
1168
|
+
# The available formats are:
|
1169
|
+
# * A4 : 0.210 x 0.297
|
1170
|
+
# * B5 : 0.176 x 0.250
|
1171
|
+
# * Letter : 0.216 x 0.279
|
1172
|
+
# * Legal : 0.216 x 0.356
|
1173
|
+
# * Executive : 0.191 x 0.254
|
1174
|
+
# * A0 : 0.841 x 1.189
|
1175
|
+
# * A1 : 0.594 x 0.841
|
1176
|
+
# * A2 : 0.420 x 0.594
|
1177
|
+
# * A3 : 0.297 x 0.420
|
1178
|
+
# * A5 : 0.148 x 0.210
|
1179
|
+
# * A6 : 0.105 x 0.148
|
1180
|
+
# * A7 : 0.074 x 0.105
|
1181
|
+
# * A8 : 0.052 x 0.074
|
1182
|
+
# * A9 : 0.037 x 0.052
|
1183
|
+
# * B0 : 1.000 x 1.414
|
1184
|
+
# * B1 : 0.500 x 0.707
|
1185
|
+
# * B10 : 0.031 x 0.044
|
1186
|
+
# * B2 : 0.500 x 0.707
|
1187
|
+
# * B3 : 0.353 x 0.500
|
1188
|
+
# * B4 : 0.250 x 0.353
|
1189
|
+
# * B6 : 0.125 x 0.176
|
1190
|
+
# * B7 : 0.088 x 0.125
|
1191
|
+
# * B8 : 0.062 x 0.088
|
1192
|
+
# * B9 : 0.044 x 0.062
|
1193
|
+
# * C5E : 0.163 x 0.229
|
1194
|
+
# * Comm10E : 0.105 x 0.241
|
1195
|
+
# * DLE : 0.110 x 0.220
|
1196
|
+
# * Folio : 0.210 x 0.330
|
1197
|
+
# * Ledger : 0.432 x 0.279
|
1198
|
+
# * Tabloid : 0.279 x 0.432
|
1199
|
+
# @param orientation [String] Page orientation (Landscape, Portait)
|
524
1200
|
def beginprintext(*)
|
525
1201
|
super
|
526
1202
|
end
|
@@ -529,7 +1205,6 @@ module GR
|
|
529
1205
|
super
|
530
1206
|
end
|
531
1207
|
|
532
|
-
# ndctowc
|
533
1208
|
def ndctowc(x, y)
|
534
1209
|
inquiry %i[double double] do |px, py|
|
535
1210
|
px.write_double x
|
@@ -538,7 +1213,6 @@ module GR
|
|
538
1213
|
end
|
539
1214
|
end
|
540
1215
|
|
541
|
-
# wctondc
|
542
1216
|
def wctondc(x, y)
|
543
1217
|
inquiry %i[double double] do |px, py|
|
544
1218
|
px.write_double x
|
@@ -547,7 +1221,6 @@ module GR
|
|
547
1221
|
end
|
548
1222
|
end
|
549
1223
|
|
550
|
-
# wc3towc
|
551
1224
|
def wc3towc(x, y, z)
|
552
1225
|
inquiry %i[double double double] do |px, py, pz|
|
553
1226
|
px.write_double x
|
@@ -557,36 +1230,109 @@ module GR
|
|
557
1230
|
end
|
558
1231
|
end
|
559
1232
|
|
1233
|
+
# Draw a rectangle using the current line attributes.
|
1234
|
+
# @param xmin [Numeric] Lower left edge of the rectangle
|
1235
|
+
# @param xmax [Numeric] Lower right edge of the rectangle
|
1236
|
+
# @param ymin [Numeric] Upper left edge of the rectangle
|
1237
|
+
# @param ymax [Numeric] Upper right edge of the rectangle
|
560
1238
|
def drawrect(*)
|
561
1239
|
super
|
562
1240
|
end
|
563
1241
|
|
1242
|
+
# Draw a filled rectangle using the current fill attributes.
|
1243
|
+
# @param xmin [Numeric] Lower left edge of the rectangle
|
1244
|
+
# @param xmax [Numeric] Lower right edge of the rectangle
|
1245
|
+
# @param ymin [Numeric] Upper left edge of the rectangle
|
1246
|
+
# @param ymax [Numeric] Upper right edge of the rectangle
|
564
1247
|
def fillrect(*)
|
565
1248
|
super
|
566
1249
|
end
|
567
1250
|
|
1251
|
+
# Draw a circular or elliptical arc covering the specified rectangle.
|
1252
|
+
# @param xmin [Numeric] Lower left edge of the rectangle
|
1253
|
+
# @param xmax [Numeric] Lower right edge of the rectangle
|
1254
|
+
# @param ymin [Numeric] Upper left edge of the rectangle
|
1255
|
+
# @param ymax [Numeric] Upper right edge of the rectangle
|
1256
|
+
# @param a1 [Numeric] The start angle
|
1257
|
+
# @param a2 [Numeric] The end angle
|
1258
|
+
# The resulting arc begins at `a1` and ends at `a2` degrees. Angles are interpreted
|
1259
|
+
# such that 0 degrees is at the 3 o'clock position. The center of the arc is the center
|
1260
|
+
# of the given rectangle.
|
568
1261
|
def drawarc(*)
|
569
1262
|
super
|
570
1263
|
end
|
571
1264
|
|
1265
|
+
# Fill a circular or elliptical arc covering the specified rectangle.
|
1266
|
+
# @param xmin [Numeric] Lower left edge of the rectangle
|
1267
|
+
# @param xmax [Numeric] Lower right edge of the rectangle
|
1268
|
+
# @param ymin [Numeric] Upper left edge of the rectangle
|
1269
|
+
# @param ymax [Numeric] Upper right edge of the rectangle
|
1270
|
+
# @param a1 [Numeric] The start angle
|
1271
|
+
# @param a2 [Numeric] The end angle
|
1272
|
+
# The resulting arc begins at `a1` and ends at `a2` degrees. Angles are interpreted
|
1273
|
+
# such that 0 degrees is at the 3 o'clock position. The center of the arc is the center
|
1274
|
+
# of the given rectangle.
|
572
1275
|
def fillarc(*)
|
573
1276
|
super
|
574
1277
|
end
|
575
1278
|
|
576
1279
|
# Draw simple and compound outlines consisting of line segments and bezier curves.
|
1280
|
+
# @param points [Array, NArray] (N, 2) array of (x, y) vertices
|
1281
|
+
# @parm codes [Array, NArray] N-length array of path codes
|
1282
|
+
# * STOP : end the entire path
|
1283
|
+
# * MOVETO : move to the given vertex
|
1284
|
+
# * LINETO : draw a line from the current position to the given vertex
|
1285
|
+
# * CURVE3 : draw a quadratic Bézier curve
|
1286
|
+
# * CURVE4 : draw a cubic Bézier curve
|
1287
|
+
# * CLOSEPOLY : draw a line segment to the start point of the current path
|
1288
|
+
# @parm fill [Integer] A flag indication whether resulting path is to be filled or not
|
577
1289
|
def drawpath(points, codes, fill)
|
578
1290
|
len = codes.length
|
579
1291
|
super(len, points, uint8(codes), fill)
|
580
1292
|
end
|
581
1293
|
|
1294
|
+
# Set the arrow style to be used for subsequent arrow commands.
|
1295
|
+
# @param style [Integer] The arrow style to be used
|
1296
|
+
# The default arrow style is 1.
|
1297
|
+
# * 1 : simple, single-ended
|
1298
|
+
# * 2 : simple, single-ended, acute head
|
1299
|
+
# * 3 : hollow, single-ended
|
1300
|
+
# * 4 : filled, single-ended
|
1301
|
+
# * 5 : triangle, single-ended
|
1302
|
+
# * 6 : filled triangle, single-ended
|
1303
|
+
# * 7 : kite, single-ended
|
1304
|
+
# * 8 : filled kite, single-ended
|
1305
|
+
# * 9 : simple, double-ended
|
1306
|
+
# * 10 : simple, double-ended, acute head
|
1307
|
+
# * 11 : hollow, double-ended
|
1308
|
+
# * 12 : filled, double-ended
|
1309
|
+
# * 13 : triangle, double-ended
|
1310
|
+
# * 14 : filled triangle, double-ended
|
1311
|
+
# * 15 : kite, double-ended
|
1312
|
+
# * 16 : filled kite, double-ended
|
1313
|
+
# * 17 : double line, single-ended
|
1314
|
+
# * 18 : double line, double-ended
|
1315
|
+
# `setarrowstyle` defines the arrow style for subsequent arrow primitives.
|
582
1316
|
def setarrowstyle(*)
|
583
1317
|
super
|
584
1318
|
end
|
585
1319
|
|
1320
|
+
# Set the arrow size to be used for subsequent arrow commands.
|
1321
|
+
# @param size [Numeric] The arrow size to be used
|
1322
|
+
# `setarrowsize` defines the arrow size for subsequent arrow primitives.
|
1323
|
+
# The default arrow size is 1.
|
586
1324
|
def setarrowsize(*)
|
587
1325
|
super
|
588
1326
|
end
|
589
1327
|
|
1328
|
+
# Draw an arrow between two points.
|
1329
|
+
# @param x1 [Numeric] Starting point of the arrow (tail)
|
1330
|
+
# @param y1 [Numeric] Starting point of the arrow (tail)
|
1331
|
+
# @param x2 [Numeric] Head of the arrow
|
1332
|
+
# @param y2 [Numeric] Head of the arrow
|
1333
|
+
# Different arrow styles (angles between arrow tail and wing, optionally filled
|
1334
|
+
# heads, double headed arrows) are available and can be set with the `setarrowstyle`
|
1335
|
+
# function.
|
590
1336
|
def drawarrow(*)
|
591
1337
|
super
|
592
1338
|
end
|
@@ -601,6 +1347,23 @@ module GR
|
|
601
1347
|
end
|
602
1348
|
|
603
1349
|
# Draw an image into a given rectangular area.
|
1350
|
+
# @param xmin [Numeric] First corner point of the rectangle
|
1351
|
+
# @param ymin [Numeric] First corner point of the rectangle
|
1352
|
+
# @param xmax [Numeric] Second corner point of the rectangle
|
1353
|
+
# @param ymax [Numeric] Second corner point of the rectangle
|
1354
|
+
# @param width [Integer] The width and the height of the image
|
1355
|
+
# @param height [Integer] The width and the height of the image
|
1356
|
+
# @param data [Array, NArray] An array of color values dimensioned `width` by `height`
|
1357
|
+
# @param model [Integer] Color model ( default = 0 )
|
1358
|
+
# The available color models are:
|
1359
|
+
# * 0 : MODEL_RGB
|
1360
|
+
# * AABBGGRR
|
1361
|
+
# * 1 : MODEL_HSV
|
1362
|
+
# * AAVVSSHH
|
1363
|
+
# The points (`xmin`, `ymin`) and (`xmax`, `ymax`) are world coordinates defining
|
1364
|
+
# diagonally opposite corner points of a rectangle. This rectangle is divided into
|
1365
|
+
# `width` by `height` cells. The two-dimensional array `data` specifies colors
|
1366
|
+
# for each cell.
|
604
1367
|
def drawimage(xmin, xmax, ymin, ymax, width, height, data, model = 0)
|
605
1368
|
super(xmin, xmax, ymin, ymax, width, height, uint(data), model)
|
606
1369
|
end
|
@@ -609,21 +1372,40 @@ module GR
|
|
609
1372
|
super
|
610
1373
|
end
|
611
1374
|
|
1375
|
+
# `setshadow` allows drawing of shadows, realized by images painted underneath,
|
1376
|
+
# and offset from, graphics objects such that the shadow mimics the effect of a light
|
1377
|
+
# source cast on the graphics objects.
|
1378
|
+
# @param offsetx [Numeric]
|
1379
|
+
# An x-offset, which specifies how far in the horizontal direction the
|
1380
|
+
# shadow is offset from the object
|
1381
|
+
# @param offsety [Numeric]
|
1382
|
+
# A y-offset, which specifies how far in the vertical direction the shadow
|
1383
|
+
# is offset from the object
|
1384
|
+
# @param blur [Numeric]
|
1385
|
+
# A blur value, which specifies whether the object has a hard or a diffuse edge
|
612
1386
|
def setshadow(*)
|
613
1387
|
super
|
614
1388
|
end
|
615
1389
|
|
1390
|
+
# Set the value of the alpha component associated with GR colors.
|
1391
|
+
# @param alpha [Numeric] An alpha value (0.0 - 1.0)
|
616
1392
|
def settransparency(*)
|
617
1393
|
super
|
618
1394
|
end
|
619
1395
|
|
620
1396
|
# Change the coordinate transformation according to the given matrix.
|
1397
|
+
# @param mat [Array, NArray] 2D transformation matrix
|
621
1398
|
def setcoordxform(mat)
|
622
1399
|
raise if mat.size != 6
|
623
1400
|
|
624
1401
|
super(mat)
|
625
1402
|
end
|
626
1403
|
|
1404
|
+
# Open a file for graphics output.
|
1405
|
+
# @param path [String] Filename for the graphics file.
|
1406
|
+
# `begingraphics` allows to write all graphics output into a XML-formatted file until
|
1407
|
+
# the `endgraphics` functions is called. The resulting file may later be imported with
|
1408
|
+
# the `importgraphics` function.
|
627
1409
|
def begingraphics(*)
|
628
1410
|
super
|
629
1411
|
end
|
@@ -640,6 +1422,11 @@ module GR
|
|
640
1422
|
super
|
641
1423
|
end
|
642
1424
|
|
1425
|
+
# Generate a character string starting at the given location. Strings can be defined
|
1426
|
+
# to create mathematical symbols and Greek letters using LaTeX syntax.
|
1427
|
+
# @param x [Numeric] Position of the text string specified in world coordinates
|
1428
|
+
# @param y [Numeric] Position of the text string specified in world coordinates
|
1429
|
+
# @param string [String] The text string to be drawn
|
643
1430
|
def mathtex(*)
|
644
1431
|
super
|
645
1432
|
end
|
@@ -667,7 +1454,6 @@ module GR
|
|
667
1454
|
super
|
668
1455
|
end
|
669
1456
|
|
670
|
-
# inqbbox
|
671
1457
|
def inqbbox
|
672
1458
|
inquiry %i[double double double double] do |*pts|
|
673
1459
|
super(*pts)
|
@@ -716,12 +1502,15 @@ module GR
|
|
716
1502
|
end
|
717
1503
|
|
718
1504
|
# Draw a triangular surface plot for the given data points.
|
1505
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
1506
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
1507
|
+
# @param z [Array, NArray] A list containing the Z coordinates
|
719
1508
|
def trisurface(px, py, pz)
|
720
1509
|
n = [px, py, pz].map(&:length).min
|
721
1510
|
super(n, px, py, pz)
|
722
1511
|
end
|
723
1512
|
|
724
|
-
#
|
1513
|
+
# @deprecated
|
725
1514
|
def gradient(x, y, z)
|
726
1515
|
# TODO: check: Arrays have incorrect length or dimension.
|
727
1516
|
nx = x.length
|
@@ -731,7 +1520,17 @@ module GR
|
|
731
1520
|
end
|
732
1521
|
end
|
733
1522
|
|
734
|
-
# quiver
|
1523
|
+
# Draw a quiver plot on a grid of nx*ny points.
|
1524
|
+
# @param nx [Integer] The number of points along the x-axis of the grid
|
1525
|
+
# @param ny [Integer] The number of points along the y-axis of the grid
|
1526
|
+
# @param x [Array, NArray] A list containing the X coordinates
|
1527
|
+
# @param y [Array, NArray] A list containing the Y coordinates
|
1528
|
+
# @param u [Array, NArray] A list containing the U component for each point on the grid
|
1529
|
+
# @param v [Array, NArray] A list containing the V component for each point on the grid
|
1530
|
+
# @param color [Integer]
|
1531
|
+
# A bool to indicate whether or not the arrows should be colored using
|
1532
|
+
# the current colormap
|
1533
|
+
# The values for `x` and `y` are in world coordinates.
|
735
1534
|
def quiver(x, y, u, v, color)
|
736
1535
|
# TODO: check: Arrays have incorrect length or dimension.
|
737
1536
|
nx = x.length
|
@@ -739,7 +1538,26 @@ module GR
|
|
739
1538
|
super(nx, ny, x, y, u, v, (color ? 1 : 0))
|
740
1539
|
end
|
741
1540
|
|
742
|
-
#
|
1541
|
+
# Interpolation in two dimensions using one of four different methods. The
|
1542
|
+
# input points are located on a grid, described by `x`, `y` and `z`.
|
1543
|
+
# The target grid ist described by `xq` and `yq`.
|
1544
|
+
# Returns an array containing the resulting z-values.
|
1545
|
+
# @param x [Array, NArray] Array containing the input grid's x-values
|
1546
|
+
# @param y [Array, NArray] Array containing the input grid's y-values
|
1547
|
+
# @param z [Array, NArray] Array containing the input grid's z-values (number of values: nx * ny)
|
1548
|
+
# @param xq [Array, NArray] Array containing the target grid's x-values
|
1549
|
+
# @param yq [Array, NArray] Array containing the target grid's y-values
|
1550
|
+
# @param method [Integer] Used method for interpolation
|
1551
|
+
# The available methods for interpolation are the following:
|
1552
|
+
# * 0 : INTERP2_NEAREST
|
1553
|
+
# * Nearest neighbour interpolation
|
1554
|
+
# * 1 : INTERP2_LINEAR
|
1555
|
+
# * Linear interpolation
|
1556
|
+
# * 2 : INTERP_2_SPLINE
|
1557
|
+
# * Interpolation using natural cubic splines
|
1558
|
+
# * 3 : INTERP2_CUBIC
|
1559
|
+
# * Cubic interpolation
|
1560
|
+
# @param extrapval [Numeric] The extrapolation value
|
743
1561
|
def interp2(x, y, z, xq, yq, method, extrapval) # flatten
|
744
1562
|
nx = x.length
|
745
1563
|
ny = y.length
|
@@ -751,12 +1569,30 @@ module GR
|
|
751
1569
|
end
|
752
1570
|
end
|
753
1571
|
|
754
|
-
# version
|
1572
|
+
# Returns the combined version strings of the GR runtime.
|
755
1573
|
def version
|
756
1574
|
super.read_string
|
757
1575
|
end
|
758
1576
|
|
759
1577
|
# Display a point set as a aggregated and rasterized image.
|
1578
|
+
# @param x [Array, NArray] A pointer to the X coordinates
|
1579
|
+
# @param y [Array, NArray] A pointer to the Y coordinates
|
1580
|
+
# @param dims [Array, NArray] The size of the grid used for rasterization
|
1581
|
+
# @param xform [Integer] The transformation type used for color mapping
|
1582
|
+
# The available transformation types are:
|
1583
|
+
# * 0 : XFORM_BOOLEAN
|
1584
|
+
# * boolean
|
1585
|
+
# * 1 : XFORM_LINEAR
|
1586
|
+
# * linear
|
1587
|
+
# * 2 : XFORM_LOG
|
1588
|
+
# * logarithmic
|
1589
|
+
# * 3 : XFORM_LOGLOG
|
1590
|
+
# * double logarithmic
|
1591
|
+
# * 4 : XFORM_CUBIC
|
1592
|
+
# * cubic
|
1593
|
+
# * 5 : XFORM_EQUALIZED
|
1594
|
+
# * histogram equalized
|
1595
|
+
# The values for `x` and `y` are in world coordinates.
|
760
1596
|
def shadepoints(x, y, dims: [1200, 1200], xform: 1)
|
761
1597
|
n = x.length
|
762
1598
|
w, h = dims
|
@@ -764,25 +1600,93 @@ module GR
|
|
764
1600
|
end
|
765
1601
|
|
766
1602
|
# Display a line set as an aggregated and rasterized image.
|
1603
|
+
# @param x [Array, NArray] A pointer to the X coordinates
|
1604
|
+
# @param y [Array, NArray] A pointer to the Y coordinates
|
1605
|
+
# @param dims [Array, NArray] The size of the grid used for rasterization
|
1606
|
+
# @param xform [Integer] The transformation type used for color mapping
|
1607
|
+
# The available transformation types are:
|
1608
|
+
# * 0 : XFORM_BOOLEAN
|
1609
|
+
# * boolean
|
1610
|
+
# * 1 : XFORM_LINEAR
|
1611
|
+
# * linear
|
1612
|
+
# * 2 : XFORM_LOG
|
1613
|
+
# * logarithmic
|
1614
|
+
# * 3 : XFORM_LOGLOG
|
1615
|
+
# * double logarithmic
|
1616
|
+
# * 4 : XFORM_CUBIC
|
1617
|
+
# * cubic
|
1618
|
+
# * 5 : XFORM_EQUALIZED
|
1619
|
+
# * histogram equalized
|
1620
|
+
# The values for `x` and `y` are in world coordinates.
|
1621
|
+
# NaN values can be used to separate the point set into line segments.
|
767
1622
|
def shadelines(x, y, dims: [1200, 1200], xform: 1)
|
768
1623
|
n = x.length
|
769
1624
|
w, h = dims
|
770
1625
|
super(n, x, y, xform, w, h)
|
771
1626
|
end
|
772
1627
|
|
773
|
-
def panzoom(*)
|
774
|
-
super
|
775
|
-
end
|
776
|
-
|
777
1628
|
# panzoom
|
778
1629
|
def panzoom(x, y, zoom)
|
779
1630
|
inquiry %i[double double double double] do |xmin, xmax, ymin, ymax|
|
780
1631
|
super(x, y, zoom, zoom, xmin, xmax, ymin, ymax)
|
781
1632
|
end
|
782
1633
|
end
|
783
|
-
end
|
784
1634
|
|
785
|
-
|
1635
|
+
# Set the resample method used for gr.drawimage().
|
1636
|
+
# @param resample_method [Integer] the new resample method.
|
1637
|
+
# The available options are:
|
1638
|
+
# * 0x00000000 : RESAMPLE_DEFAULT
|
1639
|
+
# * default
|
1640
|
+
# * 0x01010101 : RESAMPLE_NEAREST
|
1641
|
+
# * nearest neighbour
|
1642
|
+
# * 0x02020202 : RESAMPLE_LINEAR
|
1643
|
+
# * linear
|
1644
|
+
# * 0x03030303 : RESAMPLE_LANCZOS
|
1645
|
+
# * Lanczos
|
1646
|
+
# Alternatively, combinations of these methods can be selected for horizontal or vertical upsampling or downsampling:
|
1647
|
+
# * 0x00000000 : UPSAMPLE_VERTICAL_DEFAULT
|
1648
|
+
# * default for vertical upsampling
|
1649
|
+
# * 0x00000000 : UPSAMPLE_HORIZONTAL_DEFAULT
|
1650
|
+
# * default for horizontal upsampling
|
1651
|
+
# * 0x00000000 : DOWNSAMPLE_VERTICAL_DEFAULT
|
1652
|
+
# * default for vertical downsampling
|
1653
|
+
# * 0x00000000 : DOWNSAMPLE_HORIZONTAL_DEFAULT
|
1654
|
+
# * default for horizontal downsampling
|
1655
|
+
# * 0x00000001 : UPSAMPLE_VERTICAL_NEAREST
|
1656
|
+
# * nearest neighbor for vertical upsampling
|
1657
|
+
# * 0x00000100 : UPSAMPLE_HORIZONTAL_NEAREST
|
1658
|
+
# * nearest neighbor for horizontal upsampling
|
1659
|
+
# * 0x00010000 : DOWNSAMPLE_VERTICAL_NEAREST
|
1660
|
+
# * nearest neighbor for vertical downsampling
|
1661
|
+
# * 0x01000000 : DOWNSAMPLE_HORIZONTAL_NEAREST
|
1662
|
+
# * nearest neighbor for horizontal downsampling
|
1663
|
+
# * 0x00000002 : UPSAMPLE_VERTICAL_LINEAR
|
1664
|
+
# * linear for vertical upsampling
|
1665
|
+
# * 0x00000200 : UPSAMPLE_HORIZONTAL_LINEAR
|
1666
|
+
# * linear for horizontal upsampling
|
1667
|
+
# * 0x00020000 : DOWNSAMPLE_VERTICAL_LINEAR
|
1668
|
+
# * linear for vertical downsampling
|
1669
|
+
# * 0x02000000 : DOWNSAMPLE_HORIZONTAL_LINEAR
|
1670
|
+
# * linear for horizontal downsampling
|
1671
|
+
# * 0x00000003 : UPSAMPLE_VERTICAL_LANCZOS
|
1672
|
+
# * lanczos for vertical upsampling
|
1673
|
+
# * 0x00000300 : UPSAMPLE_HORIZONTAL_LANCZOS
|
1674
|
+
# * lanczos for horizontal upsampling
|
1675
|
+
# * 0x00030000 : DOWNSAMPLE_VERTICAL_LANCZOS
|
1676
|
+
# * lanczos for vertical downsampling
|
1677
|
+
# * 0x03000000 : DOWNSAMPLE_HORIZONTAL_LANCZOS
|
1678
|
+
# * lanczos for horizontal downsampling
|
1679
|
+
def setresamplemethod(*)
|
1680
|
+
super
|
1681
|
+
end
|
1682
|
+
|
1683
|
+
# Inquire the resample method used for gr.drawimage().
|
1684
|
+
def inqresamplemethod
|
1685
|
+
inquiry_uint do |resample_method|
|
1686
|
+
super(resample_method)
|
1687
|
+
end
|
1688
|
+
end
|
1689
|
+
end
|
786
1690
|
|
787
1691
|
ASF_BUNDLED = 0
|
788
1692
|
ASF_INDIVIDUAL = 1
|
@@ -968,6 +1872,21 @@ module GR
|
|
968
1872
|
FONT_ZAPFCHANCERY_MEDIUMITALIC = 130
|
969
1873
|
FONT_ZAPFDINGBATS = 131
|
970
1874
|
|
1875
|
+
# GR.beginprint types
|
1876
|
+
PRINT_PS = 'ps'
|
1877
|
+
PRINT_EPS = 'eps'
|
1878
|
+
PRINT_PDF = 'pdf'
|
1879
|
+
PRINT_PGF = 'pgf'
|
1880
|
+
PRINT_BMP = 'bmp'
|
1881
|
+
PRINT_JPEG = 'jpeg'
|
1882
|
+
PRINT_JPG = 'jpg'
|
1883
|
+
PRINT_PNG = 'png'
|
1884
|
+
PRINT_TIFF = 'tiff'
|
1885
|
+
PRINT_TIF = 'tif'
|
1886
|
+
PRINT_FIG = 'fig'
|
1887
|
+
PRINT_SVG = 'svg'
|
1888
|
+
PRINT_WMF = 'wmf'
|
1889
|
+
|
971
1890
|
PATH_STOP = 0x00
|
972
1891
|
PATH_MOVETO = 0x01
|
973
1892
|
PATH_LINETO = 0x02
|
@@ -984,4 +1903,21 @@ module GR
|
|
984
1903
|
XFORM_LOGLOG = 3
|
985
1904
|
XFORM_CUBIC = 4
|
986
1905
|
XFORM_EQUALIZED = 5
|
1906
|
+
|
1907
|
+
UPSAMPLE_VERTICAL_DEFAULT = 0x00000000
|
1908
|
+
UPSAMPLE_HORIZONTAL_DEFAULT = 0x00000000
|
1909
|
+
DOWNSAMPLE_VERTICAL_DEFAULT = 0x00000000
|
1910
|
+
DOWNSAMPLE_HORIZONTAL_DEFAULT = 0x00000000
|
1911
|
+
UPSAMPLE_VERTICAL_NEAREST = 0x00000001
|
1912
|
+
UPSAMPLE_HORIZONTAL_NEAREST = 0x00000100
|
1913
|
+
DOWNSAMPLE_VERTICAL_NEAREST = 0x00010000
|
1914
|
+
DOWNSAMPLE_HORIZONTAL_NEAREST = 0x01000000
|
1915
|
+
UPSAMPLE_VERTICAL_LINEAR = 0x00000002
|
1916
|
+
UPSAMPLE_HORIZONTAL_LINEAR = 0x00000200
|
1917
|
+
DOWNSAMPLE_VERTICAL_LINEAR = 0x00020000
|
1918
|
+
DOWNSAMPLE_HORIZONTAL_LINEAR = 0x02000000
|
1919
|
+
UPSAMPLE_VERTICAL_LANCZOS = 0x00000003
|
1920
|
+
UPSAMPLE_HORIZONTAL_LANCZOS = 0x00000300
|
1921
|
+
DOWNSAMPLE_VERTICAL_LANCZOS = 0x00030000
|
1922
|
+
DOWNSAMPLE_HORIZONTAL_LANCZOS = 0x03000000
|
987
1923
|
end
|