ruby-gr 0.0.23 → 0.58.1.0

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