module NumRu::GGraph and others in ggraph.rb

Index

module NumRu::GGraph

A graphic library for GPhys using RubyDCL.

This module uses GPhys but is not a part of it. More specifically, even though this module is included in the GPhys distribution, the class NumRu::GPhys knows nothing about it, and GGraph accesses GPhys only though public methods. So GGraph is not an insider, and you can make another graphic library if you like.

Module Functions

margin_info(program=nil, data_source=nil, char_height=nil, date=nil, xl=0.0, xr=0.0, yb=nil, yt=0.0)

Sets the strings to appear in the bottom margin.

This method sets margin widths as DCL.slmgn(xl, xr, yb, yt), and sets the 1st and 2nd margin strings as program and data.

ARGUMENTS

title(string)

Shows title by DCL.uxmttl('t',string,0.0). Graphic methods such as contour calls this by default.

RETURN VALUE

annotate(str_ary)

Show texts on the right margin of the viewport. Graphic methods such as contour calls this by default.

ARGUMENTS

RETURN VALUE

fig(xax=nil, yax=nil, options=nil)

Define a figure by setting viewport, window, and coordinate transform id (itr) from two 1D VArrays xax and yax (which are not needed if a map projection is specified with the optional parameter 'itr').

DCL.grfrm or DCL.grfig is called depending options provided.

ARGUMENTS

RETURN VALUE

POSSIBLE EXCEPTIONS

set_fig(options)

Change the default option values for fig.

ARGUMENTS

RETURN VALUE

POSSIBLE EXCEPTIONS

next_fig(options)

Set the option values effective only in the next call of fig (cleared then).

These value are overwritten if specified explicitly in the next call of fig.

ARGUMENTS

RETURN VALUE

POSSIBLE EXCEPTIONS

axes(xax=nil, yax=nil, options=nil)

Draw axes using (by default) info in xax and yax if non-nil.

ARGUMENTS

RETURN VALUE

POSSIBLE EXCEPTIONS

set_axes(options)

Change the default option values for axes.

ARGUMENTS

RETURN VALUE

POSSIBLE EXCEPTIONS

next_axes(options)

Set the option values effective only in the next call of axes (cleared then).

These value are overwritten if specified explicitly in the next call of axes.

ARGUMENTS

RETURN VALUE

POSSIBLE EXCEPTIONS

sim_trn?

Returns whether the current coordinate transformation is a rectangular curvelinear coordinate. A coordinate transformation must have been established with fig or DCL::grstrf. Mainly for internal usage, but a user can use it too.

RETURN VALUE

polar_coordinate_boundaries(xax=nil,yax=nil)

Draw boundaries in a polar coordinate.

ARGUMENTS

RETURN VALUE

map_trn?

Returns whether the current coordinate transformation is a map projection.

A coordinate transformation must have been established with fig or DCL::grstrf. Mainly for internal usage, but a user can use it too.

RETURN VALUE

map(options=nil)

(For map projection) Draws map grid and/or lim and/or coast lines etc.

ARGUMENTS

RETURN VALUE

POSSIBLE EXCEPTIONS

set_map(options)

Change the default option values for map.

ARGUMENTS

RETURN VALUE

POSSIBLE EXCEPTIONS

next_map(options)

Set the option values effective only in the next call of map (cleared then).

These value are overwritten if specified explicitly in the next call of map.

ARGUMENTS

RETURN VALUE

POSSIBLE EXCEPTIONS

line(gphys, newframe=true, options=nil)

Plot a poly-line by selecting the first dimension (with GPhys#first1D) if gphys is more than 2D.

ARGUMENTS

RETURN VALUE

mark(gphys, newframe=true, options=nil)

Similar to line but plots marks instead of drawing a poly-line.

ARGUMENTS

RETURN VALUE

tone_and_contour(gphys, newframe=true, options=nil)

Calls tone and contour successively. You can specify the options for any of these.

NOTE:

contour(gphys, newframe=true, options=nil)

Contour plot by selecting the first 2 dimensions (with GPhys#first2D) if gphys is more than 3D.

Contour levels are determined as follows:

ARGUMENTS

RETURN VALUE

set_contour_levels(options)

Set contour levels for contour explicitly by values with the option levels.

ARGUMENTS

clear_contour_levels

Clear contour levels set by set_contour_levels.

set_linear_contour_options(options)

Change the default option values regarding linear contour level setting in contour.

ARGUMENTS

RETURN VALUE

next_linear_contour_options(options)

Similar to set_linear_contour_options but the setting is effective only for the next call of contour.

tone(gphys, newframe=true, options=nil)

Color tone or shading by selecting the first 2 dimensions (with GPhys#first2D) if gphys is more than 3D.

Tone levels are determined as follows:

ARGUMENTS

RETURN VALUE

color_bar (options=nil)

set_tone_levels(options)

Set tone levels for tone explicitly by values.

ARGUMENTS

clear_tone_levels

Clear tone levels set by set_tone_levels.

set_linear_tone_options(options)

Change the default option values regarding linear tone level setting in tone.

ARGUMENTS

RETURN VALUE

next_linear_tone_options(options)

Similar to set_linear_tone_options but the setting is effective only for the next call of tone.

vector(fx, fy, newframe=true, options=nil)

2-D vector plot using DCL_Ext::flow_vect, which scales vectors in physical ("U") coordinates.

ARGUMENTS

RETURN VALUE

module NumRu::DCLExt

Collection of various compound DCL functions for convenience. This module is to be separated but temporarily included in ggraph.rb while it is premature.

Index

MATH1

GRPH1

GRPH2

Module Functions

glpack

gl_set_params(hash)

Calls DCL.glpset multiple times (for each key and val of hash).

ARGUMENTS

RETURN VALUE

EXAMPLES

sgpack

sg_set_params(hash)

Calls DCL.sgpset multiple times (for each key and val of hash).

See gl_set_params for usage.

slpack

sl_set_params(hash)

Calls DCL.slpset multiple times (for each key and val of hash).

See gl_set_params for usage.

swpack

sw_set_params(hash)

Calls DCL.swpset multiple times (for each key and val of hash).

See gl_set_params for usage.

uzpack

uz_set_params(hash)

Calls DCL.uzpset multiple times (for each key and val of hash).

See gl_set_params for usage.

ulpack

ul_set_params(hash)

Calls DCL.ulpset multiple times (for each key and val of hash).

See gl_set_params for usage.

ucpack

uc_set_params(hash)

Calls DCL.ucpset multiple times (for each key and val of hash).

See gl_set_params for usage.

uupack

uu_set_params(hash)

Calls DCL.uupset multiple times (for each key and val of hash).

See gl_set_params for usage.

uspack

us_set_params(hash)

Calls DCL.uspset multiple times (for each key and val of hash).

See gl_set_params for usage.

udpack

ud_set_params(hash)

Calls DCL.udpset multiple times (for each key and val of hash).

ARGUMENTS

RETURN VALUE

EXAMPLES

ud_set_linear_levs(v, options)

Set contour levels with a constant interval

ARGUMENTS

ud_set_contour(levels,index=nil,line_type=nil,label=nil,label_height=nil)

Set contours of at specified levels.

Normally you do not have to specify label and label_height.

It calls DCL.udsclv for each level. So the arguments are basically the same as DCL.udsclv, but only levels are mandatory here.

ARGUMENTS

If nil, the value of 'indxmn' is used.

RETURN VALUE

ud_add_contour(levels,index=nil,line_type=nil,label=nil,label_height=nil)

Same as ud_set_contour, but does not clear the contour levels that have been set.

uepack

ue_set_params(hash)

Calls DCL.uepset multiple times (for each key and val of hash).

See gl_set_params for usage.

ue_set_linear_levs(v, options)

Set tone levels with a constant interval

ARGUMENTS

ue_set_tone(levels, patterns)

Set tone levels and patterns.

patterns are set between levels as follows:

when (levels.length == patterns.length+1)

  levels[0]  |  levels[1]  |  levels[2]  ...  |  levels[-2]  |  levels[-1]
         patterns[0]   patterns[1]   ...  patterns[-2]   patterns[-1]

when (levels.length == patterns.length)

  levels[0]  |  levels[1]  |  levels[2]  ...  |  levels[-1]  |  +infty
         patterns[0]   patterns[1]   ...  patterns[-2]   patterns[-1]

when (levels.length == patterns.length-1)

  -infty  |  levels[0]  |  levels[1]  ...  |  levels[-1]  |  +infty
      patterns[0]   patterns[1]   ...  patterns[-2]   patterns[-1]

else
  error (exception raised)

ARGUMENTS

RETURN VALUE

ue_add_tone(levels, patterns)

Same as ue_set_tone, but does not clear the tone levels that have been set.

ugpack

ug_set_params(hash)

Calls DCL.ugpset multiple times (for each key and val of hash). See gl_set_params for usage.

umpack

um_set_params(hash)

Calls DCL.umpset multiple times (for each key and val of hash).

See gl_set_params for usage.

Original methods:

Longitude/Latitude Axes

lon_ax( options=nil )

Draw longitude axis. (label format: degrees + 'E' or 'W')

ARGUMENTS

lat_ax( options=nil )

Draw latitude axis. (label format: degrees + 'N' or 'S')

ARGUMENTS

Vectors

unit_vect( vxfxratio, vyfyratio, fxunit=nil, fyunit=nil, options=nil )

Show the "unit vector", which indicate the vector scaling.

ARGUMENTS

set_unit_vect_options(options)

Change the default option values for unit_vect.

next_unit_vect_options(options)

Set the option values effective only in the next call of unit_vect

flow_vect( fx, fy, factor=1.0, xintv=1, yintv=1)

2D Vector plot. Unlike DCL::ugvect, scaling are made in term of the physical (or "U") coordinate.

This method is meant to substitute DCL::ugvect. The scaling is made in terms of the U coordinate. This method is suitable to show vectors such as velocity, since the arrow direction represets the direction in the U coordinate. Also, one can re-scale the vector length easily by using the argument factor.

Currently, this method is not compatible with map projection, since it calls DCL::ugvect internally.

ARGUMENTS

flow_itr5( fx, fy, factor=1.0, unit_vect=false )

2D Vector plot on the polar coodinate.

This method just perform rotatation of the vector in U-coordinate to N-coordinate and passed to DCL.ugvect.

ARGUMENTS

Color bars

set_color_bar_options(options)

To set options of color_bar effective in the rest.

color_bar(options=nil)