ruby-gr 0.0.21 → 0.0.26

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