package gr

  1. Overview
  2. Docs

OCaml Bindings for the GR Framework

GR is based on an implementation of a Graphical Kernel System (GKS) and OpenGL. As a self-contained system it can quickly and easily be integrated into existing applications.

The GR framework can be used in imperative programming systems or integrated into modern object-oriented systems, in particular those based on GUI toolkits. GR is characterized by its high interoperability and can be used with modern web technologies and mobile devices. The GR framework is especially suitable for real-time environments.

module Lowlevel : sig ... end
type workstation_type =
  1. | WISS
    (*

    Workstation Independent Segment ptr Storage

    *)
  2. | WinGDI
    (*

    Windows ptr GDI

    *)
  3. | PS_1
    (*

    PostScript (b/w @-> color)

    *)
  4. | PS_2
    (*

    PostScript (b/w @-> color)

    *)
  5. | PS_3
    (*

    PostScript (b/w @-> color)

    *)
  6. | PS_4
    (*

    PostScript (b/w @-> color)

    *)
  7. | PDFPlain
    (*

    Portable Document Format ptr plain

    *)
  8. | PDFCompressed
    (*

    Portable Document Format ptr compressed

    *)
  9. | X_1
    (*

    X ptr Windows

    *)
  10. | X_2
    (*

    X ptr Windows

    *)
  11. | X_3
    (*

    X ptr Windows

    *)
  12. | X_4
    (*

    X ptr Windows

    *)
  13. | SunRF
    (*

    Sun Raster file (RF)

    *)
  14. | GIF87
    (*

    Graphics Interchange Format ptr GIF87

    *)
  15. | GIF89
    (*

    Graphics Interchange Format ptr GIF89

    *)
  16. | MotifUIL
    (*

    Motif User Interface Language (UIL)

    *)
  17. | BMP
    (*

    Windows Bitmap (BMP)

    *)
  18. | JPEG
    (*

    JPEG image ptr file

    *)
  19. | PNG
    (*

    Portable Network Graphics file (PNG)

    *)
  20. | TIFF
    (*

    Tagged Image File Format (TIFF)

    *)
  21. | Gtk
    (*

    ptr Gtk

    *)
  22. | Wx
    (*

    ptr wxWidgets

    *)
  23. | Qt4
    (*

    ptr Qt4

    *)
  24. | SVG
    (*

    Scaleable Vector Graphics (SVG)

    *)
  25. | WMF
    (*

    Windows ptr Metafile

    *)
  26. | Quartz
    (*

    ptr Quartz

    *)
  27. | Sock
    (*

    Socket ptr driver

    *)
  28. | ZMQ
    (*

    0MQ ptr driver

    *)
  29. | OGL
    (*

    ptr OpenGL

    *)

Available workstation types, see also GR Workstation Types

type linetype =
  1. | SOLID
    (*

    Solid line

    *)
  2. | DASHED
    (*

    Dashed line

    *)
  3. | DOTTED
    (*

    Dotted line

    *)
  4. | DASHED_DOTTED
    (*

    Dashed-dotted line

    *)
  5. | DASH_2_DOT
    (*

    Sequence of one dash followed by two dots

    *)
  6. | DASH_3_DOT
    (*

    Sequence of one dash followed by three dots

    *)
  7. | LONG_DASH
    (*

    Sequence of long dashes

    *)
  8. | LONG_SHORT_DASH
    (*

    Sequence of a long dash followed by a short dash

    *)
  9. | SPACED_DASH
    (*

    Sequence of dashes double spaced

    *)
  10. | SPACED_DOT
    (*

    Sequence of dots double spaced

    *)
  11. | DOUBLE_DOT
    (*

    Sequence of pairs of dots

    *)
  12. | TRIPLE_DOT
    (*

    Sequence of groups of three dots

    *)

Available line types, see also GR Line Types

type markertype =
  1. | DOT
    (*

    Smallest displayable dot

    *)
  2. | PLUS
    (*

    Plus sign

    *)
  3. | ASTERISK
    (*

    Asterisk

    *)
  4. | CIRCLE
    (*

    Hollow circle

    *)
  5. | DIAGONAL_CROSS
    (*

    Diagonal cross

    *)
  6. | SOLID_CIRCLE
    (*

    Filled circle

    *)
  7. | TRIANGLE_UP
    (*

    Hollow triangle pointing upward

    *)
  8. | SOLID_TRI_UP
    (*

    Filled triangle pointing upward

    *)
  9. | TRIANGLE_DOWN
    (*

    Hollow triangle pointing downward

    *)
  10. | SOLID_TRI_DOWN
    (*

    Filled triangle pointing downward

    *)
  11. | SQUARE
    (*

    Hollow square

    *)
  12. | SOLID_SQUARE
    (*

    Filled square

    *)
  13. | BOWTIE
    (*

    Hollow bowtie

    *)
  14. | SOLID_BOWTIE
    (*

    Filled bowtie

    *)
  15. | HGLASS
    (*

    Hollow hourglass

    *)
  16. | SOLID_HGLASS
    (*

    Filled hourglass

    *)
  17. | DIAMOND
    (*

    Hollow diamond

    *)
  18. | SOLID_DIAMOND
    (*

    Filled Diamond

    *)
  19. | STAR
    (*

    Hollow star

    *)
  20. | SOLID_STAR
    (*

    Filled Star

    *)
  21. | TRI_UP_DOWN
    (*

    Hollow triangles pointing up and down overlaid

    *)
  22. | SOLID_TRI_RIGHT
    (*

    Filled triangle point right

    *)
  23. | SOLID_TRI_LEFT
    (*

    Filled triangle pointing left

    *)
  24. | HOLLOW_PLUS
    (*

    Hollow plus sign

    *)
  25. | SOLID_PLUS
    (*

    Solid plus sign

    *)
  26. | PENTAGON
    (*

    Pentagon

    *)
  27. | HEXAGON
    (*

    Hexagon

    *)
  28. | HEPTAGON
    (*

    Heptagon

    *)
  29. | OCTAGON
    (*

    Octagon

    *)
  30. | STAR_4
    (*

    4-pointed star

    *)
  31. | STAR_5
    (*

    5-pointed star (pentagram)

    *)
  32. | STAR_6
    (*

    6-pointed star (hexagram)

    *)
  33. | STAR_7
    (*

    7-pointed star (heptagram)

    *)
  34. | STAR_8
    (*

    8-pointed star (octagram)

    *)
  35. | VLINE
    (*

    verical line

    *)
  36. | HLINE
    (*

    horizontal line

    *)
  37. | OMARK
    (*

    o-mark

    *)

Available marker types, see also GR Marker Types

type scale_options =
  1. | OPTION_X_LOG
    (*

    Logarithmic X-axis

    *)
  2. | OPTION_Y_LOG
    (*

    Logarithmic Y-axis

    *)
  3. | OPTION_Z_LOG
    (*

    Logarithmic Z-axis

    *)
  4. | OPTION_FLIP_X
    (*

    Flip X-axis

    *)
  5. | OPTION_FLIP_Y
    (*

    Flip Y-axis

    *)
  6. | OPTION_FLIP_Z
    (*

    Flip Z-axis

    *)
type spline_algo =
  1. | GeneralizedCrossValidatedSmoothing
  2. | InterpolatingNaturalCubic
  3. | CubicBSpline
type font =
  1. | TIMES_ROMAN
  2. | TIMES_ITALIC
  3. | TIMES_BOLD
  4. | TIMES_BOLDITALIC
  5. | HELVETICA
  6. | HELVETICA_OBLIQUE
  7. | HELVETICA_BOLD
  8. | HELVETICA_BOLDOBLIQUE
  9. | COURIER
  10. | COURIER_OBLIQUE
  11. | COURIER_BOLD
  12. | COURIER_BOLDOBLIQUE
  13. | SYMBOL
  14. | BOOKMAN_LIGHT
  15. | BOOKMAN_LIGHTITALIC
  16. | BOOKMAN_DEMI
  17. | BOOKMAN_DEMIITALIC
  18. | NEWCENTURYSCHLBK_ROMAN
  19. | NEWCENTURYSCHLBK_ITALIC
  20. | NEWCENTURYSCHLBK_BOLD
  21. | NEWCENTURYSCHLBK_BOLDITALIC
  22. | AVANTGARDE_BOOK
  23. | AVANTGARDE_BOOKOBLIQUE
  24. | AVANTGARDE_DEMI
  25. | AVANTGARDE_DEMIOBLIQUE
  26. | PALATINO_ROMAN
  27. | PALATINO_ITALIC
  28. | PALATINO_BOLD
  29. | PALATINO_BOLDITALIC
  30. | ZAPFCHANCERY_MEDIUMITALIC
  31. | ZAPFDINGBATS
type text_precision =
  1. | STRING
    (*

    String precision (higher quality)

    *)
  2. | CHAR
    (*

    Character precision (medium quality)

    *)
  3. | STROKE
    (*

    Stroke precision (lower quality)

    *)
type text_path_direction =
  1. | RIGHT
    (*

    left-to-right

    *)
  2. | LEFT
    (*

    right-to-left

    *)
  3. | UP
    (*

    downside-up

    *)
  4. | DOWN
    (*

    upside-down

    *)
type text_halign =
  1. | NORMAL
  2. | LEFT
    (*

    Left justify

    *)
  3. | CENTER
    (*

    Center justify

    *)
  4. | RIGHT
    (*

    Right justify

    *)
type text_valign =
  1. | NORMAL
  2. | TOP
    (*

    Align with the top of the characters

    *)
  3. | CAP
    (*

    Aligned with the cap of the characters

    *)
  4. | HALF
    (*

    Aligned with the half line of the characters

    *)
  5. | BASE
    (*

    Aligned with the base line of the characters

    *)
  6. | BOTTOM
    (*

    Aligned with the bottom line of the characters

    *)
type pattern_style

Pattern style, see also GR Fill Patterns and Hatches

val pattern_style : int -> pattern_style
type hatch_style

Hatch style, see also GR Fill Patterns and Hatches

val hatch_style : int -> hatch_style
type fill_style =
  1. | HOLLOW
    (*

    No filling. Just draw the bounding polyline

    *)
  2. | SOLID
    (*

    Fill the interior of the polygon using the fill color index

    *)
  3. | PATTERN of pattern_style
    (*

    Fill the interior of the polygon using the style index as a pattern index

    *)
  4. | HATCH of hatch_style
    (*

    Fill the interior of the polygon using the style index as a cross-hatched style

    *)
type color_map =
  1. | Uniform
  2. | Temperature
  3. | Grayscale
  4. | Glowing
  5. | Rainbowlike
  6. | Geologic
  7. | Greenscale
  8. | Cyanscale
  9. | Bluescale
  10. | Magentascale
  11. | Redscale
  12. | Flame
  13. | Brownscale
  14. | Pilatus
  15. | Autumn
  16. | Bone
  17. | Cool
  18. | Copper
  19. | Gray
  20. | Hot
  21. | Hsv
  22. | Jet
  23. | Pink
  24. | Spectral
  25. | Spring
  26. | Summer
  27. | Winter
  28. | Gist_Earth
  29. | Gist_Heat
  30. | Gist_Ncar
  31. | Gist_Rainbow
  32. | Gist_Stern
  33. | Afmhot
  34. | Brg
  35. | Bwr
  36. | Coolwarm
  37. | Cmrmap
  38. | Cubehelix
  39. | Gnuplot
  40. | Gnuplot2
  41. | Ocean
  42. | Rainbow
  43. | Seismic
  44. | Terrain
  45. | Viridis
  46. | Inferno
  47. | Plasma
  48. | Magma

Color Maps, see also GR Color Maps

type surface_options =
  1. | LINES
    (*

    Use X Y polylines to denote the surface

    *)
  2. | MESH
    (*

    Use a wire grid to denote the surface

    *)
  3. | FILLED_MESH
    (*

    Applies an opaque grid to the surface

    *)
  4. | Z_SHADED_MESH
    (*

    Applies Z-value shading to the surface

    *)
  5. | COLORED_MESH
    (*

    Applies a colored grid to the surface

    *)
  6. | CELL_ARRAY
    (*

    Applies a grid of individually-colored cells to the surface

    *)
  7. | SHADED_MESH
    (*

    Applies light source shading to the 3-D surface

    *)
type segment
module Workstation : sig ... end
module Gks : sig ... end
module State : sig ... end
val set_window : float -> float -> float -> float -> unit

set_window xmin xmax ymin ymax establishes a window, or rectangular subspace, of world coordinates to be plotted. If you desire log scaling or mirror-imaging of axes, use the gr_setscale function.

This function defines the rectangular portion of the World Coordinate space (WC) to be associated with the specified normalization transformation. The WC window and the Normalized Device Coordinates (NDC) viewport define the normalization transformation through which all output primitives are mapped. The WC window is mapped onto the rectangular NDC viewport which is, in turn, mapped onto the display surface of the open and active workstation, in device coordinates. By default, GR uses the range 0,1 x 0,1, in world coordinates, as the normalization transformation window.

Parameters

xmin: The left horizontal coordinate of the window (xmin < xmax). xmax: The right horizontal coordinate of the window (xmin < xmax). ymin: The bottom vertical coordinate of the window (ymin < ymax). ymax: The top vertical coordinate of the window (ymin < ymax).

val set_viewport : float -> float -> float -> float -> unit

set_viewport xmin xmax ymin ymax establishes a rectangular subspace of normalized device coordinates.

This function defines the rectangular portion of the Normalized Device Coordinate (NDC) space to be associated with the specified normalization transformation. The NDC viewport and World Coordinate (WC) window define the normalization transformation through which all output primitives pass. The WC window is mapped onto the rectangular NDC viewport which is, in turn, mapped onto the display surface of the open and active workstation, in device coordinates.

Parameters

xmin: The left horizontal coordinate of the viewport (0 <= xmin < xmax). xmax: The right horizontal coordinate of the viewport (xmin < xmax <= 1). ymin: The bottom vertical coordinate of the viewport (0 <= ymin < ymax). ymax: The top vertical coordinate of the viewport (ymin < ymax <= 1).

val select_transformation : int -> unit

select_transformation transform selects a predefined transformation from world coordinates to normalized device coordinates.

0 Selects the identity transformation in which both the window and viewport have the range of 0 to 1 >= 1 Selects a normalization transformation as defined by set_window and set_viewport

Parameters transform: A normalization transformation number.

val clip : bool -> unit

clip indicator sets the clipping indicator.

false Clipping is off. Data outside of the window will be drawn. true Clipping is on. Data outside of the window will not be drawn.

Parameters indicator: An indicator specifying whether clipping is on or off.

This function enables or disables clipping of the image drawn in the current window. Clipping is defined as the removal of those portions of the graph that lie outside of the defined viewport. If clipping is on, GR does not draw generated output primitives past the viewport boundaries. If clipping is off, primitives may exceed the viewport boundaries, and they will be drawn to the edge of the workstation window. By default, clipping is on.

val segment : int -> segment
val create_segment : segment -> unit
val set_segment_transform : segment -> float -> float -> float -> float -> float -> float -> float -> unit
val close_segment : unit -> unit
val set_space : float -> float -> int -> int -> int

set_space zmin zmax rotation tilt sets the abstract Z-space used for mapping three-dimensional output primitives into the current world coordinate space.

This function establishes the limits of an abstract Z-axis and defines the angles for rotation and for the viewing angle (tilt) of a simulated three-dimensional graph, used for mapping corresponding output primitives into the current window. These settings are used for all subsequent three-dimensional output primitives until other values are specified. Angles of rotation and viewing angle must be specified between 0 and 90 degrees.

Parameters zmin: Minimum value for the Z-axis. zmax: Maximum value for the Z-axis. rotation: Angle for the rotation of the X axis, in degrees. tilt: Viewing angle of the Z axis, in degrees.

val set_linetype : linetype -> unit
val set_linewidth : float -> unit

set_linewidth lw defines the line width of subsequent polyline output primitives.

The line width is calculated as the nominal line width generated on the workstation multiplied by the line width scale factor. This value is mapped by the workstation to the nearest available line width. The default line width is 1.0, or 1 times the line width generated on the graphics device.

val set_linecolorindex : int -> unit

set_linecolorindex c defines the color of subsequent polyline output primitives. Note: c < 1256

val set_markertype : markertype -> unit
val set_markersize : float -> unit

set_markersize ms specify the marker size for polymarkers.

The polymarker size is calculated as the nominal size generated on the graphics device multiplied by the marker size scale factor.

val set_markercolorindex : int -> unit

set_markercolorindex c define the color of subsequent markers output primitives. Note: c < 1256

val set_arrowstyle : int -> unit

set_arrowstyle style sets the arrow style to be used for subsequent arrow commands.

This function defines the arrow style for subsequent arrow primitives. The default arrow style is 1.

Parameters style: The arrow style to be used. Available styles are:

1 simple, single-ended 2 simple, single-ended, acute head 3 hollow, single-ended 4 filled, single-ended 5 triangle, single-ended 6 filled triangle, single-ended 7 kite, single-ended 8 filled kite, single-ended 9 simple, double-ended 10 simple, double-ended, acute head 11 hollow, double-ended 12 filled, double-ended 13 triangle, double-ended 14 filled triangle, double-ended 15 kite, double-ended 16 filled kite, double-ended 17 double line, single-ended 18 double line, double-ended

TODO: Use a sum type.

val set_arrowsize : float -> unit
val set_text_font_prec : ?precision:text_precision -> font -> unit

set_text_font_prec ?precision font specifies the text font and precision for subsequent text output primitives.

The appearance of a font depends on the text precision value specified. STRING, CHARACTER or STROKE precision allows for a greater or lesser realization of the text primitives, for efficiency. STRING is the default precision for GR and produces the highest quality output.

XXX: CHARACTER and STROKE precision seem to be broken (and to break the axes command with it...)!

val set_char_expand_factor : float -> unit

set_char_expand_factor factor sets the current character expansion factor (width to height ratio).

This function defines the width of subsequent text output primitives. The expansion factor alters the width of the generated characters, but not their height. The default text expansion factor is 1, or one times the normal width-to-height ratio of the text.

Parameters factor: Text expansion factor applied to the nominal text width-to-height ratio

val set_text_colorindex : int -> unit

set_text_colorindex color sets the current text color index.

This function defines the color of subsequent text output primitives. GR uses the default foreground color (black=1) for the default text color index.

Parameters color: The text color index (COLOR < 1256)

val set_char_height : float -> unit

set_char_height height sets the current character height.

This function defines the height of subsequent text output primitives. Text height is defined as a percentage of the default window. GR uses the default text height of 0.027 (2.7% of the height of the default window).

val set_char_up : (float * float) -> unit

set_char_up (x, y) Set the current character text angle up vector. This function defines the vertical rotation of subsequent text output primitives. The text up vector is initially set to (0, 1), horizontal to the baseline.

Parameters x: X coordinate of the text up vector y: Y coordinate of the text up vector

val set_char_space : float -> unit
val set_text_path : text_path_direction -> unit

set_text_path direction defines the current direction in which subsequent text will be drawn.

val set_text_align : text_halign option -> text_valign option -> unit

set_text_align horizontal vertical specifies how the characters in a text primitive will be aligned in horizontal and vertical space. The default text alignment indicates horizontal left alignment and vertical baseline alignment.

val set_fill_interior_style : fill_style -> unit

set_fill_interior_style style sets the fill area interior style to be used for fill areas.

This function defines the interior style for subsequent fill area output primitives. The default interior style is HOLLOW.

val set_fill_colorindex : int -> unit

set_fill_colorindex color sets the current fill area color index.

This function defines the color of subsequent fill area output primitives. GR uses the default foreground color (black=1) for the default fill area color index.

Parameters color: The fill area color index (COLOR < 1256)

val set_color_representation : int -> (float * float * float) -> unit

set_color_representation index (red, green, blue) redefines an existing color index representation by specifying an RGB color triplet.

Parameters index: Color index in the range 0 to 1256 red: Red intensity in the range 0.0 to 1.0 green: Green intensity in the range 0.0 to 1.0 blue: Blue intensity in the range 0.0 to 1.0

val set_colormap : color_map -> unit

set_colormap cmap sets the currently used colormap.

A list of colormaps can be found at: GR Colormaps.

val set_scale : scale_options list -> int
val set_shadow : (float * float) -> float -> unit

set_shadow (offsetx, offsety) blur Allows drawing of shadows, realized by images painted underneath, and offset from, graphics objects such that the shadow mimics the effect of a light source cast on the graphics objects.

Parameters offsetx: An x-offset, which specifies how far in the horizontal direction the shadow is offset from the object offsety: A y-offset, which specifies how far in the vertical direction the shadow is offset from the object blur: A blur value, which specifies whether the object has a hard or a diffuse edge

val set_transparency : float -> unit

set_transparency alpha sets the value of the alpha component associated with GR colors.

Parameters alpha: An alpha value (0.0 - 1.0)

val set_coord_transform : (float Ctypes_static.ptr, 'a, 'b) Stdlib.Bigarray.Genarray.t -> unit

set_coord_transform transform Change the coordinate transformation according to the given matrix. Parameters mat: 2D transformation matrix (3x2)

module Graphics : sig ... end
val polyline : ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> unit

polyline ?linetype ?linewidth ?coloridx x y draws a polyline using the current line attributes, starting from the first data point and ending at the last data point.

The values for x and y are in world coordinates. The attributes that control the appearance of a polyline are linetype, linewidth and color index.

val polyline3d : ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> (float, 'e, 'f) Stdlib.Bigarray.Genarray.t -> unit

polyline3d ?linetype ?linewidth ?coloridx x y z draws a polyline using the current line attributes, starting from the first data point and ending at the last data point.

The values for x, y and z are in world coordinates. The attributes that control the appearance of a polyline are linetype, linewidth and color index.

val polymarker : ?markertype:markertype -> ?markersize:float -> ?coloridx:int -> (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> unit

polymarker ?markertype ?markersize ?coloridx x y draws marker symbols centered at the given data points.

The values for x and y are in world coordinates. The attributes that control the appearance of a polyline are markertype, markersize and color index.

val polymarker3d : ?markertype:markertype -> ?markersize:float -> ?coloridx:int -> (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> (float, 'e, 'f) Stdlib.Bigarray.Genarray.t -> unit

polymarker3d ?markertype ?markersize ?coloridx x y z draws marker symbols centered at the given data points.

The values for x, y and z are in world coordinates. The attributes that control the appearance of a polyline are markertype, markersize and color index.

val text : float -> float -> string -> unit

text x y content draws a text at position x, y using the current text attributes.

The values for x and y are in normalized device coordinates. The attributes that control the appearance of text are text font and precision, character expansion factor, character spacing, text color index, character height, character up vector, text path and text alignment.

val fillarea : (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> unit

fillarea x y allows you to specify a polygonal shape of an area to be filled. The vectors x and y specify the coordinates of the polygonal shape corners.

The attributes that control the appearance of fill areas are fill area interior style, fill area style index and fill area color index.

val cellarray : (float * float) -> (float * float) -> (int * int) -> (int * int) -> (int * int) -> (int, 'a, 'b) Stdlib.Bigarray.Genarray.t -> unit

cellarray (xmin, xmax) (ymin, ymax) (dimx, dimy) (scol, srow) (ncol, nrow) color displays rasterlike images in a device-independent manner. The cell array function partitions a rectangle given by two corner points into DIMX X DIMY cells, each of them colored individually by the corresponding color index of the given cell array.

The values for xmin, xmax, ymin and ymax are in world coordinates.

Parameters: xmin: X coordinate of the lower left point of the rectangle ymin: Y coordinate of the lower left point of the rectangle xmax: X coordinate of the upper right point of the rectangle ymax: Y coordinate of the upper right point of the rectangle dimx: X dimension of the color index array dimy: Y dimension of the color index array scol: number of leading columns in the color index array srow: number of leading rows in the color index array ncol: total number of columns in the color index array nrow: total number of rows in the color index array color: color index array

Note: gr_nonuniformcellarray and gr_polycellarray have been introduced in newer versions of gr.

val spline : ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> int -> spline_algo -> unit

spline ?linetype ?linewidth ?coloridx x y m method_t generates a cubic spline-fit, starting from the first data point and ending at the last data point.

The values for x and y are in world coordinates. The attributes that control the appearance of a spline-fit are linetype, linewidth and color index.

Parameters x: The X coordinates y: The Y coordinates m: The number of points in the polygon to be drawn (m > n) method: The smoothing method

If method is > 0, then a generalized cross-validated smoothing spline is calculated. If method is 0, then an interpolating natural cubic spline is calculated. If method is < -1, then a cubic B-spline is calculated.

val gridit : (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> (float, 'e, 'f) Stdlib.Bigarray.Genarray.t -> (int * int) -> (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t * (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t * (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t

gridit x y z (nx, ny) interpolates data from arbitrary points at points on a rectangular grid.

Parameters

x: The X coordinates of the input points y: The Y coordinates of the input points z: The values of the points nx: The number of points in X direction for the output grid ny: The number of points in Y direction for the output grid

Returns the tuple (x', y', z') with

x': The points in X direction for the output grid y': The points in Y direction for the output grid z': The interpolated values on the nx x ny grid points

val tex_text : (float * float) -> string -> int

tex_text (x, y) text draws a text at position x, y using the current text attributes. Strings can be defined to create basic mathematical expressions and Greek letters.

The values for X and Y are in normalized device coordinates. The attributes that control the appearance of text are text font and precision, character expansion factor, character spacing, text color index, character height, character up vector, text path and text alignment.

Parameters x: The X coordinate of starting position of the text string y: The Y coordinate of starting position of the text string text: The text to be drawn

The character string is interpreted to be a simple mathematical formula. The following notations apply:

  • Subscripts and superscripts: These are indicated by carets (‘^’) and underscores (‘_’). If the sub/superscript contains more than one character, it must be enclosed in curly braces (‘{}’).
  • Fractions are typeset with A ‘/’ B, where A stands for the numerator and B for the denominator.

To include a Greek letter you must specify the corresponding keyword after a backslash (‘') character. The text translator produces uppercase or lowercase Greek letters depending on the case of the keyword. For more sophisticated mathematical formulas, you should use the gr_mathtex function.

See the full documentation at GR Documentation for gr_textext.

val math_tex : (float * float) -> string -> unit

math_tex (x, y) tex generates a character string starting at the given location. Strings can be defined to create mathematical symbols and Greek letters using LaTeX syntax.

Parameters x: The X coordinate of the starting position of the text string y: The Y coordinate of the starting position of the text string tex: The TeX text string to be drawn

val axes : ?scale:scale_options list -> ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> ?origin:(float * float) -> ?major:(int * int) -> ?tick_size:float -> float -> float -> unit

axes ?scale ?linetype ?linewidth ?origin:(0,0) ?major:(0,0) ?size:1 x_tick y_tick draws X and Y coordinate axes with linearly and/or logarithmically spaced tick marks. Tick marks are positioned along each axis so that major tick marks fall on the axes origin (whether visible or not). Major tick marks are labeled with the corresponding data values. Axes are drawn according to the scale of the window.

Parameters x_tick: The interval between minor tick marks on the X axis. y_tick: The interval between minor tick marks on the Y axis. x_org: The world coordinate of the origin (point of intersection) of the X axis. y_org: The world coordinate of the origin (point of intersection) of the Y axis. major_x: 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. major_y: 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. tick_size: 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)

val axes_labels : ?scale:scale_options list -> ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> ?origin:(float * float) -> ?major:(int * int) -> ?tick_size:float -> (float -> float -> string -> float -> unit) -> (float -> float -> string -> float -> unit) -> float -> float -> unit

axes_labels ?(scale = []) ?linetype ?linewidth ?coloridx ?(origin = 0.0, 0.0) ?(major = 0, 0) ?(tick_size = -0.01) (fpx : float -> float -> string -> float -> unit) (fpy : float -> float -> string -> float -> unit) x_tick y_tick creates axes in the current workspace and supply a custom function for changing the behaviour of the tick labels.

Similar to axes but allows more fine-grained control over tick labels and text positioning by supplying callback functions. Within the callback function you can use normal GR text primitives for performing any manipulations on the label text.

See axes for more details on drawing axes.

Parameters

x_tick: The interval between minor tick marks on the X axis. y_tick: The interval between minor tick marks on the Y axis. x_org: The world coordinate of the origin (point of intersection) of the X axis. y_org: The world coordinate of the origin (point of intersection) of the Y axis. major_x: 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. major_y: 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. tick_size: 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). fpx: 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: x: NDC of the label in X direction. y: NDC of the label in Y direction. svalue: Internal string representation of the text drawn by GR at (x,y). value: Floating point representation of the label drawn at (x,y). fpy: Exactly same as the fpx above, but for the the Y axis.

val axes3d : ?scale:scale_options list -> ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> ?origin:(float * float * float) -> ?major:(int * int * int) -> ?tick_size:float -> float -> float -> float -> unit

axes3d ?scale ?linetype ?linewidth ?origin:(0,0) ?major:(0,0) ?size:1 x_tick y_tick draws X, Y and Z coordinate axes with linearly and/or logarithmically spaced tick marks. Tick marks are positioned along each axis so that major tick marks fall on the axes origin (whether visible or not). Major tick marks are labeled with the corresponding data values. Axes are drawn according to the scale of the window.

Parameters x_tick: The interval between minor tick marks on the X axis. y_tick: The interval between minor tick marks on the Y axis. z_tick: The length in world coordinates of the interval between minor grid lines in Z direction. x_org: The world coordinate of the origin (point of intersection) of the X axis. y_org: The world coordinate of the origin (point of intersection) of the Y axis. z_org: The world coordinate of the origin (point of intersection) of the Z axis. major_x: 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. major_y: 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. major_z: Unitless integer value specifying the number of minor grid lines between major grid lines on the Z axis. Values of 0 or 1 imply no grid lines. tick_size: 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)

val surface : ?options:surface_options -> (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> (float, 'e, 'f) Stdlib.Bigarray.Genarray.t -> unit

surface x y z ?option draws a three-dimensional surface plot for the given data points.

x and y define a grid. z is a singly dimensioned array containing at least nx * ny data points. z describes the surface height at each point on the grid. Data is ordered as shown in the following table:

Parameters

nx: The number of points along the X axis ny: The number of points along the Y axis px: A pointer to the X coordinates py: A pointer to the Y coordinates pz: A pointer to the Z coordinates option: Surface display option (see table)

val contour : ?major_h:int -> (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> (float, 'e, 'f) Stdlib.Bigarray.Genarray.t -> (float, 'g, 'h) Stdlib.Bigarray.Genarray.t -> unit

contour ?major_h x y h z sraw contours of a three-dimensional data set whose values are specified over a rectangular mesh. Contour lines may optionally be labeled.

Parameters

nx: The number of points along the X axis ny: The number of points along the Y axis nh: The number of height values px: A pointer to the X coordinates py: A pointer to the Y coordinates h: A pointer to the height values pz: A pointer to the Z coordinates major_h: Directs GR to label contour lines. For example, a value of 3 would label every third line. A value of 1 will label every line. A value of 0 produces no labels. To produce colored contour lines, add an offset of 1000 to major_h

val contourf : ?major_h:int -> (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> (float, 'e, 'f) Stdlib.Bigarray.Genarray.t -> (float, 'g, 'h) Stdlib.Bigarray.Genarray.t -> unit

contourf ?(major_h = 0) x y h z draws filled contour plot of a three-dimensional data set whose values are specified over a rectangular mesh.

Parameters px: A pointer to the X coordinates py: A pointer to the Y coordinates h: A pointer to the height values. If NULL, use nh evenly distributed height values between minimum and maximum Z value. major_h: Directs GR to label contour lines. For example, a value of 3 would label every third line. A value of 1 will label every line. A value of 0 produces no labels. To produce colored contour lines, add an offset of 1000 to major_h

val grid : ?scale:scale_options list -> ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> ?origin:(float * float) -> ?major:(int * int) -> float -> float -> unit

grid ?scale ?linetype ?linewidth ?origin:(0,0) ?major:(0,0) x_tick y_tick draws a linear and/or logarithmic grid.

Major grid lines correspond to the axes origin and major tick marks whether visible or not. Minor grid lines are drawn at points equal to minor tick marks. Major grid lines are drawn using black lines and minor grid lines are drawn using gray lines.

Parameters

x_tick: The length in world coordinates of the interval between minor grid lines in X direction. y_tick: The length in world coordinates of the interval between minor grid lines in Y direction. x_org: The world coordinate of the origin (point of intersection) of the X axis. y_org: The world coordinate of the origin (point of intersection) of the Y axis. major_x: Unitless integer value specifying the number of minor grid lines between major grid lines on the X axis. Values of 0 or 1 imply no grid lines. major_y: Unitless integer value specifying the number of minor grid lines between major grid lines on the Y axis. Values of 0 or 1 imply no grid lines.

val grid3d : ?scale:scale_options list -> ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> ?origin:(float * float * float) -> ?major:(int * int * int) -> float -> float -> float -> unit

grid3d ?scale ?linetype ?linewidth ?origin:(0,0,0) ?major:(0,0,0) x_tick y_tick z_tick draws a linear and/or logarithmic grid.

Major grid lines correspond to the axes origin and major tick marks whether visible or not. Minor grid lines are drawn at points equal to minor tick marks. Major grid lines are drawn using black lines and minor grid lines are drawn using gray lines.

Parameters

x_tick: The length in world coordinates of the interval between minor grid lines in X direction. y_tick: The length in world coordinates of the interval between minor grid lines in Y direction. z_tick: The length in world coordinates of the interval between minor grid lines in Z direction. x_org: The world coordinate of the origin (point of intersection) of the X axis. y_org: The world coordinate of the origin (point of intersection) of the Y axis. z_org: The world coordinate of the origin (point of intersection) of the Z axis. major_x: Unitless integer value specifying the number of minor grid lines between major grid lines on the X axis. Values of 0 or 1 imply no grid lines. major_y: Unitless integer value specifying the number of minor grid lines between major grid lines on the Y axis. Values of 0 or 1 imply no grid lines. major_z: Unitless integer value specifying the number of minor grid lines between major grid lines on the Z axis. Values of 0 or 1 imply no grid lines.

val vertical_errorbars : (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> (float, 'e, 'f) Stdlib.Bigarray.Genarray.t -> (float, 'g, 'h) Stdlib.Bigarray.Genarray.t -> unit

vertical_errorbars x y el eu draws a standard vertical error bar graph.

Parameters px: A pointer to the X coordinates py: A pointer to the Y coordinates el: A pointer to the absolute values of the lower error bar data eu: A pointer to the absolute values of the upper error bar data

val horizontal_errorbars : (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> (float, 'e, 'f) Stdlib.Bigarray.Genarray.t -> (float, 'g, 'h) Stdlib.Bigarray.Genarray.t -> unit

horizontal_errorbars x y el eu draws a standard horizontal error bar graph.

Parameters px: A pointer to the X coordinates py: A pointer to the Y coordinates el: A pointer to the absolute values of the lower error bar data eu: A pointer to the absolute values of the upper error bar data

val titles3d : string -> string -> string -> unit

titles3d x_title y_title z_title displays axis titles just outside of their respective axes.

Parameters x_title: The text to be displayed on the X axis y_title: The text to be displayed on the Y axis z_title: The text to be displayed on the Z axis

val tricontour : (float, 'a, 'b) Stdlib.Bigarray.Genarray.t -> (float, 'c, 'd) Stdlib.Bigarray.Genarray.t -> (float, 'e, 'f) Stdlib.Bigarray.Genarray.t -> (float, 'g, 'h) Stdlib.Bigarray.Genarray.t -> unit

tricontour x y z levels draws a contour plot for the given triangle mesh.

Parameters x: A pointer to the X coordinates y: A pointer to the Y coordinates z: A pointer to the Z coordinates levels: A pointer to the contour levels

val colorbar : unit -> unit

colorbar () plots a colorbar.

val tick : float -> float -> float
module Print : sig ... end
val drawrect : ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> float -> float -> float -> float -> unit

drawrect ?linetype ?linewidth ?coloridx left right bottom up draws a rectangle.

Parameters left: Left edge of the rectangle right: Right edge of the rectangle bottom: Bottom edge of the rectangle up: Upper edge of the rectangle

val fillrect : ?fillstyle:fill_style -> ?fillcoloridx:int -> ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> float -> float -> float -> float -> unit

fillrect ?fillstyle ?fillcoloridx ?linetype ?linewidth ?coloridx left right bottom up draws a filled rectangle.

Parameters left: Left edge of the rectangle right: Right edge of the rectangle bottom: Bottom edge of the rectangle up: Upper edge of the rectangle

val drawarc : ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> float -> float -> float -> float -> int -> int -> unit

drawarc ?linetype ?linewidth ?coloridx left right bottom up a1 a2 draws a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at a1 and ends at a2 degrees. Angles are interpreted such that 0 degrees is at the 3 o’clock position. The center of the arc is the center of the given rectangle.

Parameters left: Left edge of the rectangle right: Right edge of the rectangle bottom: Bottom edge of the rectangle up: Upper edge of the rectangle a1: The start angle a2: The end angle

val fillarc : ?fillstyle:fill_style -> ?fillcoloridx:int -> ?linetype:linetype -> ?linewidth:float -> ?coloridx:int -> float -> float -> float -> float -> int -> int -> unit

fillarc ?fillstyle ?fillcoloridx ?linetype ?linewidth ?coloridx left right bottom up draws a filled circular or elliptical arc covering the specified rectangle.

The resulting arc begins at a1 and ends at a2 degrees. Angles are interpreted such that 0 degrees is at the 3 o’clock position. The center of the arc is the center of the given rectangle.

Parameters left: Left edge of the rectangle right: Right edge of the rectangle bottom: Bottom edge of the rectangle up: Upper edge of the rectangle a1: The start angle a2: The end angle

val drawpath : (float * float) array -> [< `CLOSEPOLY | `CURVE3 | `CURVE4 | `LINETO | `MOVETO | `STOP ] array -> bool -> unit

drawpath vertices codes fill draws simple and compound outlines consisting of line segments and bezier curves.

The following path codes are recognized: `STOP end the entire path `MOVETO move to the given vertex `LINETO draw a line from the current position to the given vertex `CURVE3 draw a quadratic Bezier curve `CURVE4 draw a cubic Bezier curve `CLOSEPOLY draw a line segment to the start point of the current path

Parameters vertices: the vertices (x,y) codes: path codes fill: A flag indication whether resulting path is to be filled or not

val drawarrow : ?arrowsize:float -> ?arrowstyle:int -> (float * float) -> (float * float) -> unit

drawarrow ?arrowsize ?arrowstyle (x1, y1) (x2, y2) draws an arrow between two points.

Different arrow styles (angles between arrow tail and wing, optionally filled heads, double headed arrows) are available. Check the documentation of set_arrowstyle and set_arrowsize for more information.

Parameters

x1: The X coordinate of the arrow start point (tail) y1: The Y coordinate of the arrow start point (tail) x2: The X coordinate of the arrow end point (head) y2: The Y coordinate of the arrow end point (head)

val drawimage : (float * float) -> (float * float) -> (int, 'a, 'b) Stdlib.Bigarray.Genarray.t -> [< `HSV | `RGB ] -> unit

drawimage (xmin, ymin) (xmax, ymax) image_data model draws an image into a given rectangular area.

The points (xmin, ymin) and (xmax, ymax) are world coordinates defining diagonally opposite corner points of a rectangle. This rectangle is divided into width by height cells. The two-dimensional array data specifies colors for each cell.

Parameters

xmin: X coordinate of the lower left point of the rectangle ymin: Y coordinate of the lower left point of the rectangle xmax: X coordinate of the upper right point of the rectangle ymax: Y coordinate of the upper right point of the rectangle width: X dimension of the color index array height: Y dimension of the color index array data: color array model: color model

The available color models are: RGB 0 AABBGGRR HSV 1 AAVVSSHH

module Selection : sig ... end