MathGL core
***********

nav

The core of MathGL is mglGraph class defined in #include <mgl2/mgl.h>. It contains a lot of plotting functions for 1D, 2D and 3D data. It also encapsulates parameters for axes drawing. Moreover an arbitrary coordinate transformation can be used for each axis. All plotting functions use data encapsulated in mglData class (see Data processing) that allows to check sizes of used arrays easily. Also it have many functions for data handling: modify it by formulas, find momentums and distribution (histogram), apply operator (differentiate, integrate, transpose, Fourier and so on), change data sizes (interpolate, squeeze, crop and so on). Additional information about colors, fonts, formula parsing can be found in General concepts and Other classes.

Some of MathGL features will appear only in novel versions. To test used MathGL version you can use following function.
 -- MGL command: version 'ver'
 -- Method on mglGraph: bool CheckVersion (const char *ver) static
 -- C function: int mgl_check_version (const char *ver)
     Return zero if MathGL version is appropriate for required by VER, i.e. if major version is the same and minor version is greater or equal to one in VER.

external

Create and delete objects
=========================

nav

 -- Constructor on mglGraph: mglGraph (int kind=0, int width=600, int height=400)
 -- Constructor on mglGraph: mglGraph (const mglGraph &gr)
 -- Constructor on mglGraph: mglGraph (HMGL gr)
 -- C function: HMGL mgl_create_graph (int width, int height)
 -- C function: HMGL mgl_create_graph_gl ()
     Creates the instance of class mglGraph with specified sizes WIDTH and HEIGHT. Parameter KIND may have following values: 0 -- use default plotter, 1 -- use OpenGL plotter.

 -- Destructor on mglGraph: ~mglGraph ()
 -- C function: HMGL mgl_delete_graph (HMGL gr)
     Deletes the instance of class mglGraph.

 -- Method on mglGraph: HMGL Self ()
     Returns the pointer to internal object of type HMGL.

 -- C function: HMGL mgl_default_graph ()
     Returns pointer to default instance of class mglGraph. This is default instance, used with new classes, which can be used to keep plot settings and to speed up initialization in small different plots.

external

Graphics setup
==============

nav

Functions and variables in this group influences on overall graphics appearance. So all of them should be placed before any actual plotting function calls.

 -- MGL command: reset
 -- Method on mglGraph: void DefaultPlotParam ()
 -- C function: void mgl_set_def_param (HMGL gr)
     Restore initial values for all of parameters and clear the image.

 -- MGL command: setup val flag
 -- Method on mglGraph: void SetFlagAdv (int val, uint32_t flag)
 -- C function: void mgl_set_flag (HMGL gr, int val, uint32_t flag)
     Sets the value of internal binary FLAG to VAL. The list of flags can be found at define.h (https://sourceforge.net/p/mathgl/code/HEAD/tree/mathgl-2x/include/mgl2/define.h#l267). The current list of flags are:
     #define MGL_ENABLE_CUT		0x00000004 	///< Flag which determines how points outside bounding box are drown.
     #define MGL_ENABLE_RTEXT 	0x00000008 	///< Use text rotation along axis
     #define MGL_AUTO_FACTOR		0x00000010 	///< Enable autochange PlotFactor
     #define MGL_ENABLE_ALPHA 	0x00000020 	///< Flag that Alpha is used
     #define MGL_ENABLE_LIGHT 	0x00000040 	///< Flag of using lightning
     #define MGL_TICKS_ROTATE 	0x00000080 	///< Allow ticks rotation
     #define MGL_TICKS_SKIP		0x00000100 	///< Allow ticks rotation
     #define MGL_DISABLE_SCALE	0x00000200 	///< Temporary flag for disable scaling (used for axis)
     #define MGL_FINISHED 		0x00000400 	///< Flag that final picture (i.e. mglCanvas::G) is ready
     #define MGL_USE_GMTIME		0x00000800 	///< Use gmtime instead of localtime
     #define MGL_SHOW_POS		0x00001000 	///< Switch to show or not mouse click position
     #define MGL_CLF_ON_UPD		0x00002000 	///< Clear plot before Update()
     #define MGL_NOSUBTICKS		0x00004000 	///< Disable subticks drawing (for bounding box)
     #define MGL_LOCAL_LIGHT		0x00008000 	///< Keep light sources for each inplot
     #define MGL_VECT_FRAME		0x00010000 	///< Use DrwDat to remember all data of frames
     #define MGL_REDUCEACC		0x00020000 	///< Reduce accuracy of points (to reduce size of output files)
     #define MGL_PREFERVC 		0x00040000 	///< Prefer vertex color instead of texture if output format supports
     #define MGL_ONESIDED 		0x00080000 	///< Render only front side of surfaces if output format supports (for debugging)
     #define MGL_NO_ORIGIN 		0x00100000 	///< Don't draw tick labels at axis origin
     #define MGL_GRAY_MODE 		0x00200000 	///< Convert all colors to gray ones
     #define MGL_FULL_CURV 		0x00400000 	///< Disable omitting points in straight-line part(s)
     #define MGL_NO_SCALE_REL 	0x00800000 	///< Disable font scaling in relative inplots

 -- C function: void mgl_bsize (unsigned bsize)
     Set buffer size for number of primitives as (1<<bsize)^2. I.e. as 10^12 for bsize=20 or 4*10^9 for bsize=16 (default). NOTE: you set it only once before any plotting. The current value is returned.

external

Transparency
------------

nav

There are several functions and variables for setup transparency. The general function is alpha which switch on/off the transparency for overall plot. It influence only for graphics which created after alpha call (with one exception, OpenGL). Function alphadef specify the default value of alpha-channel. Finally, function transptype set the kind of transparency. Transparency and lighting

 -- MGL command: alpha [val=on]
 -- Method on mglGraph: void Alpha (bool enable)
 -- C function: void mgl_set_alpha (HMGL gr, int enable)
     Sets the transparency on/off and returns previous value of transparency. It is recommended to call this function before any plotting command. Default value is transparency off.

 -- MGL command: alphadef val
 -- Method on mglGraph: void SetAlphaDef (mreal val)
 -- C function: void mgl_set_alpha_default (HMGL gr, mreal alpha)
     Sets default value of alpha channel (transparency) for all plotting functions. Initial value is 0.5.

 -- MGL command: transptype val
 -- Method on mglGraph: void SetTranspType (int type)
 -- C function: void mgl_set_transp_type (HMGL gr, int type)
     Set the type of transparency. Possible values are:

       * Normal transparency (0) -- below things is less visible than upper ones. It does not look well in OpenGL mode (mglGraphGL) for several surfaces.

       * Glass-like transparency (1) -- below and upper things are commutable and just decrease intensity of light by RGB channel.

       * Lamp-like transparency (2) -- below and upper things are commutable and are the source of some additional light. I recommend to set SetAlphaDef(0.3) or less for lamp-like transparency.

     Types of transparency.

external

Lighting
--------

nav

There are several functions for setup lighting. The general function is light which switch on/off the lighting for overall plot. It influence only for graphics which created after light call (with one exception, OpenGL). Generally MathGL support up to 10 independent light sources. But in OpenGL mode only 8 of light sources is used due to OpenGL limitations. The position, color, brightness of each light source can be set separately. By default only one light source is active. It is source number 0 with white color, located at top of the plot. Lighting sample

 -- MGL command: light [val=on]
 -- Method on mglGraph: bool Light (bool enable)
 -- C function: void mgl_set_light (HMGL gr, int enable)
     Sets the using of light on/off for overall plot. Function returns previous value of lighting. Default value is lightning off.

 -- MGL command: light num val
 -- Method on mglGraph: void Light (int n, bool enable)
 -- C function: void mgl_set_light_n (HMGL gr, int n, int enable)
     Switch on/off N-th light source separately.

 -- MGL command: light num xdir ydir zdir ['col'='w' br=0.5]
 -- MGL command: light num xdir ydir zdir xpos ypos zpos ['col'='w' br=0.5 ap=0]
 -- Method on mglGraph: void AddLight (int n, mglPoint d, char c='w', mreal bright=0.5, mreal ap=0)
 -- Method on mglGraph: void AddLight (int n, mglPoint r, mglPoint d, char c='w', mreal bright=0.5, mreal ap=0)
 -- C function: void mgl_add_light (HMGL gr, int n, mreal dx, mreal dy, mreal dz)
 -- C function: void mgl_add_light_ext (HMGL gr, int n, mreal dx, mreal dy, mreal dz, char c, mreal bright, mreal ap)
 -- C function: void mgl_add_light_loc (HMGL gr, int n, mreal rx, mreal ry, mreal rz, mreal dx, mreal dy, mreal dz, char c, mreal bright, mreal ap)
     The function adds a light source with identification N in direction D with color C and with brightness BRIGHT (which must be in range [0,1]). If position R is specified and isn't NAN then light source is supposed to be local otherwise light source is supposed to be placed at infinity.

 -- MGL command: diffuse val
 -- Method on mglGraph: void SetDiffuse (mreal bright)
 -- C function: void mgl_set_difbr (HMGL gr, mreal bright)
     Set brightness of diffusive light (only for local light sources).

 -- MGL command: ambient val
 -- Method on mglGraph: void SetAmbient (mreal bright=0.5)
 -- C function: void mgl_set_ambbr (HMGL gr, mreal bright)
     Sets the brightness of ambient light. The value should be in range [0,1].

 -- MGL command: attachlight val
 -- Method on mglGraph: void AttachLight (bool val)
 -- C function: void mgl_set_attach_light (HMGL gr, int val)
     Set to attach light settings to inplot/subplot. Note, OpenGL and some output formats don't support this feature.

external

Fog
---

nav

 -- MGL command: fog val [dz=0.25]
 -- Method on mglGraph: void Fog (mreal d, mreal dz=0.25)
 -- C function: void mgl_set_fog (HMGL gr, mreal d, mreal dz)
     Function imitate a fog in the plot. Fog start from relative distance DZ from view point and its density growths exponentially in depth. So that the fog influence is determined by law ~ 1-exp(-d*z). Here z is normalized to 1 depth of the plot. If value D=0 then the fog is absent. Note, that fog was applied at stage of image creation, not at stage of drawing. Adding fog

external

Default sizes
-------------

nav

These variables control the default (initial) values for most graphics parameters including sizes of markers, arrows, line width and so on. As any other settings these ones will influence only on plots created after the settings change.

 -- MGL command: barwidth val
 -- Method on mglGraph: void SetBarWidth ( mreal val)
 -- C function: void mgl_set_bar_width (HMGL gr, mreal val)
     Sets relative width of rectangles in bars, barh, boxplot, candle, ohlc. Default value is 0.7.

 -- MGL command: marksize val
 -- Method on mglGraph: void SetMarkSize (mreal val)
 -- C function: void mgl_set_mark_size (HMGL gr, mreal val)
     Sets size of marks for 1D plotting. Default value is 1.

 -- MGL command: arrowsize val
 -- Method on mglGraph: void SetArrowSize (mreal val)
 -- C function: void mgl_set_arrow_size (HMGL gr, mreal val)
     Sets size of arrows for 1D plotting, lines and curves (see Primitives). Default value is 1.

 -- MGL command: meshnum val
 -- Method on mglGraph: void SetMeshNum (int val)
 -- C function: void mgl_set_meshnum (HMGL gr, int num)
     Sets approximate number of lines in mesh, fall, grid2, and also the number of hachures in vect, dew, and the number of cells in cloud, and the number of markers in plot, tens, step, mark, textmark. By default (=0) it draws all lines/hachures/cells/markers.

 -- MGL command: facenum val
 -- Method on mglGraph: void SetFaceNum (int val)
 -- C function: void mgl_set_facenum (HMGL gr, int num)
     Sets approximate number of visible faces. Can be used for speeding up drawing by cost of lower quality. By default (=0) it draws all of them.

 -- MGL command: plotid 'id'
 -- Method on mglGraph: void SetPlotId (const char *id)
 -- C function: void mgl_set_plotid (HMGL gr, const char *id)
     Sets default name ID as filename for saving (in FLTK window for example).

 -- Method on mglGraph: const char * GetPlotId ()
 -- C function only: const char * mgl_get_plotid (HMGL gr)
 -- Fortran subroutine: mgl_get_plotid (long gr, char *out, int len)
     Gets default name ID as filename for saving (in FLTK window for example).

 -- MGL command: pendelta val
 -- Method on mglGraph: void SetPenDelta (double val)
 -- C function: void mgl_pen_delta (HMGL gr, double val)
     Changes the blur around lines and text (default is 1). For VAL>1 the text and lines are more sharped. For VAL<1 the text and lines are more blurred.

external

Cutting
-------

nav

These variables and functions set the condition when the points are excluded (cutted) from the drawing. Note, that a point with NAN value(s) of coordinate or amplitude will be automatically excluded from the drawing. Cutting sample

 -- MGL command: cut val
 -- Method on mglGraph: void SetCut (bool val)
 -- C function: void mgl_set_cut (HMGL gr, int val)
     Flag which determines how points outside bounding box are drawn. If it is true then points are excluded from plot (it is default) otherwise the points are projected to edges of bounding box.

 -- MGL command: cut x1 y1 z1 x2 y2 z2
 -- Method on mglGraph: void SetCutBox (mglPoint p1, mglPoint p1)
 -- C function: void mgl_set_cut_box (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2)
     Lower and upper edge of the box in which never points are drawn. If both edges are the same (the variables are equal) then the cutting box is empty.

 -- MGL command: cut 'cond'
 -- Method on mglGraph: void CutOff (const char *cond)
 -- C function: void mgl_set_cutoff (HMGL gr, const char *cond)
     Sets the cutting off condition by formula COND. This condition determine will point be plotted or not. If value of formula is nonzero then point is omitted, otherwise it plotted. Set argument as "" to disable cutting off condition.

external

Font settings
-------------

nav

 -- MGL command: font 'fnt' [val=6]
     Font style for text and labels (see text). Initial style is 'fnt'=':rC' give Roman font with centering. Parameter val sets the size of font for tick and axis labels. Default font size of axis labels is 1.4 times large than for tick labels. For more detail, see Font styles.

 -- MGL command: rotatetext val
 -- Method on mglGraph: void SetRotatedText (bool val)
 -- C function: void mgl_set_rotated_text (HMGL gr, int val)
     Sets to use or not text rotation.

 -- MGL command: scaletext val
 -- Method on mglGraph: void SetScaleText (bool val)
 -- C function: void mgl_set_scale_text (HMGL gr, int val)
     Sets to scale text in relative inplot (including columnplot, gridplot, stickplot, shearplot) or not.

 -- MGL command: texparse val
 -- Method on mglGraph: void SetTeXparse (bool val)
 -- C function: void mgl_set_tex_parse (HMGL gr, int val)
     Enables/disables TeX-like command parsing at text output.

 -- MGL command: loadfont ['name'='']
 -- Method on mglGraph: void LoadFont (const char *name, const char *path="")
 -- C function: void mgl_load_font (HMGL gr, const char *name, const char *path)
     Load font typeface from PATH/NAME. Empty name will load default font.

 -- Method on mglGraph: void SetFontDef (const char *fnt)
 -- C function: void mgl_set_font_def (HMGL gr, const char * val)
     Sets the font specification (see Text printing). Default is rC -- Roman font centering.

 -- Method on mglGraph: void SetFontSize (mreal val)
 -- C function: void mgl_set_font_size (HMGL gr, mreal val)
     Sets the size of font for tick and axis labels. Default font size of axis labels is 1.4 times large than for tick labels.

 -- Method on mglGraph: void SetFontSizePT (mreal cm, int dpi=72)
     Set FontSize by size in pt and picture DPI (default is 16 pt for dpi=72).

 -- Method on mglGraph: inline void SetFontSizeCM (mreal cm, int dpi=72)
     Set FontSize by size in centimeters and picture DPI (default is 0.56 cm = 16 pt).

 -- Method on mglGraph: inline void SetFontSizeIN (mreal cm, int dpi=72)
     Set FontSize by size in inch and picture DPI (default is 0.22 in = 16 pt).

 -- Method on mglGraph: void CopyFont (mglGraph * from)
 -- C function: void mgl_copy_font (HMGL gr, HMGL gr_from)
     Copy font data from another mglGraph object.

 -- Method on mglGraph: void RestoreFont ()
 -- C function: void mgl_restore_font (HMGL gr)
     Restore font data to default typeface.

 -- Method on mglGraph: void SetDefFont (const char *name, const char *path="") static
 -- C function: void mgl_def_font (const char *name, const char *path)
     Load default font typeface (for all newly created HMGL/mglGraph objects) from PATH/NAME.

external

Palette and colors
------------------

nav

 -- MGL command: palette 'colors'
 -- Method on mglGraph: void SetPalette (const char *colors)
 -- C function: void mgl_set_palette (HMGL gr, const char *colors)
     Sets the palette as selected colors. Default value is "Hbgrcmyhlnqeup" that corresponds to colors: dark gray H, blue b, green g, red r, cyan c, magenta m, yellow y, gray h, blue-green l, sky-blue n, orange q, yellow-green e, blue-violet u, purple p. The palette is used mostly in 1D plots (see 1D plotting) for curves which styles are not specified. Internal color counter will be nullified by any change of palette. This includes even hidden change (for example, by box or axis functions).

 -- Method on mglGraph: void SetDefScheme (const char *sch)
 -- C function: void mgl_set_def_sch (HMGL gr, const char *sch)
     Sets the SCH as default color scheme. Default value is "BbcyrR".

 -- Method on mglGraph: void SetColor (char id, mreal r, mreal g, mreal b) static
 -- C function: void mgl_set_color (char id, mreal r, mreal g, mreal b)
     Sets RGB values for color with given ID. This is global setting which influence on any later usage of symbol ID.

 -- MGL command: gray [val=on]
 -- Method on mglGraph: void Gray (bool enable)
 -- C function: void mgl_set_gray (HMGL gr, int enable)
     Sets the gray-scale mode on/off.

external

Masks
-----

nav

 -- MGL command: mask 'id' 'hex' [angle]
 -- Команда MGL: mask 'id' hex [angle]
 -- Method on mglGraph: void SetMask (char id, const char *hex)
 -- Method on mglGraph: void SetMask (char id, uint64_t hex)
 -- C function: void mgl_set_mask (HMGL gr, const char *hex)
 -- C function: void mgl_set_mask_val (HMGL gr, uint64_t hex)
     Sets new bit matrix HEX of size 8*8 for mask with given ID. This is global setting which influence on any later usage of symbol ID. The predefined masks are (see Color scheme): - give lines (0x000000FF00000000), + give cross-lines (080808FF08080808),	= give double lines (0000FF00FF000000),	; give dash lines (0x0000000F00000000), o give circles (0000182424180000),	O give filled circles (0000183C3C180000),	s give squares (00003C24243C0000),	S give solid squares (00003C3C3C3C0000), ~ give waves (0000060990600000),	< give left triangles (0060584658600000),	> give right triangles (00061A621A060000),	j give dash-dot lines (0000002700000000), d give pluses (0x0008083E08080000),	D give tacks (0x0139010010931000),	* give dots (0x0000001818000000),	^ give bricks (0x101010FF010101FF). Parameter ANGLE set the rotation angle too. IMPORTANT: the rotation angle will be replaced by a multiple of 45 degrees at export to EPS.

 -- MGL command: mask angle
 -- Method on mglGraph: void SetMaskAngle (int angle)
 -- C function: void mgl_set_mask_angle (HMGL gr, int angle)
     Sets the default rotation angle (in degrees) for masks. Note, you can use symbols \, /, I in color scheme for setting rotation angles as 45, -45 and 90 degrees correspondingly. IMPORTANT: the rotation angle will be replaced by a multiple of 45 degrees at export to EPS.

external

Error handling
--------------

nav

Normally user should set it to zero by SetWarn(0); before plotting and check if GetWarn() or Message() return non zero after plotting. Only last warning will be saved. All warnings/errors produced by MathGL is not critical -- the plot just will not be drawn. By default, all warnings are printed in stderr. You can disable it by using mgl_suppress_warn(true);.

 -- Method on mglGraph: void SetWarn (int code, const char *info="")
 -- C function: void mgl_set_warn (HMGL gr, int code, const char *info)
     Set warning code. Normally you should call this function only for clearing the warning state, i.e. call SetWarn(0);. Text INFO will be printed as is if CODE<0.

 -- Method on mglGraph: const char *Message ()
 -- C function only: const char *mgl_get_mess (HMGL gr)
 -- Fortran subroutine: mgl_get_mess (long gr, char *out, int len)
     Return messages about matters why some plot are not drawn. If returned string is empty then there are no messages.

 -- Method on mglGraph: int GetWarn ()
 -- C function: int mgl_get_warn (HMGL gr)
     Return the numerical ID of warning about the not drawn plot. Possible values are:

     mglWarnNone=0
          Everything OK

     mglWarnDim
          Data dimension(s) is incompatible

     mglWarnLow
          Data dimension(s) is too small

     mglWarnNeg
          Minimal data value is negative

     mglWarnFile
          No file or wrong data dimensions

     mglWarnMem
          Not enough memory

     mglWarnZero
          Data values are zero

     mglWarnLeg
          No legend entries

     mglWarnSlc
          Slice value is out of range

     mglWarnCnt
          Number of contours is zero or negative

     mglWarnOpen
          Couldn't open file

     mglWarnLId
          Light: ID is out of range

     mglWarnSize
          Setsize: size(s) is zero or negative

     mglWarnFmt
          Format is not supported for that build

     mglWarnTern
          Axis ranges are incompatible

     mglWarnNull
          Pointer is NULL

     mglWarnSpc
          Not enough space for plot

     mglScrArg
          Wrong argument(s) of a command in MGL script

     mglScrCmd
          Wrong command in MGL script

     mglScrLong
          Too long line in MGL script

     mglScrStr
          Unbalanced ' in MGL script

     mglScrTemp
          Change temporary data in MGL script

 -- Method on mglGraph: void SuppressWarn (bool state) static
 -- C function: void mgl_suppress_warn (int state)
     Disable printing warnings to stderr if STATE is nonzero.

 -- Method on mglGraph: void SetGlobalWarn (const char *info) static
 -- C function: void mgl_set_global_warn (const char *info)
     Set warning message INFO for global scope.

 -- Method on mglGraph: const char * GlobalWarn () static
 -- C function: const char * mgl_get_global_warn ()
     Get warning message(s) for global scope.

 -- Method on mglGraph: void ClearGlobalWarn () static
 -- C function: void mgl_clear_global_warn ()
     Clears global warning messages.

external

Stop drawing
------------

nav

 -- Method on mglGraph: void Stop (bool stop=true)
 -- C function only: void mgl_ask_stop (HMGL gr, int stop)
     Ask to stop drawing if STOP is non-zero, otherwise reset stop flag.

 -- Method on mglGraph: bool NeedStop ()
 -- C function only: void mgl_need_stop (HMGL gr)
     Return true if drawing should be terminated. Also it process all events in GUI. User should call this function from time to time inside a long calculation to allow processing events for GUI.

 -- Method on mglGraph: bool SetEventFunc (void (*func)(void *), void *par=NULL)
 -- C function only: void mgl_set_event_func (HMGL gr, void (*func)(void *), void *par)
     Set callback function which will be called to process events of GUI library.

external

Axis settings
=============

nav

These large set of variables and functions control how the axis and ticks will be drawn. Note that there is 3-step transformation of data coordinates are performed. Firstly, coordinates are projected if Cut=true (see Cutting), after it transformation formulas are applied, and finally the data was normalized in bounding box. Note, that MathGL will produce warning if axis range and transformation formulas are not compatible.

external

Ranges (bounding box)
---------------------

nav

 -- MGL command: xrange v1 v2 [add=off]
 -- MGL command: yrange v1 v2 [add=off]
 -- MGL command: zrange v1 v2 [add=off]
 -- MGL command: crange v1 v2 [add=off]
 -- Method on mglGraph: void SetRange (char dir, mreal v1, mreal v2)
 -- Method on mglGraph: void AddRange (char dir, mreal v1, mreal v2)
 -- C function: void mgl_set_range_val (HMGL gr, char dir, mreal v1, mreal v2)
 -- C function: void mgl_add_range_val (HMGL gr, char dir, mreal v1, mreal v2)
     Sets or adds the range for x-,y-,z- coordinate or coloring (c). If one of values is NAN then it is ignored. See also ranges.

 -- MGL command: xrange dat [add=off]
 -- MGL command: yrange dat [add=off]
 -- MGL command: zrange dat [add=off]
 -- MGL command: crange dat [add=off]
 -- Method on mglGraph: void SetRange (char dir, const mglDataA &dat, bool add=false)
 -- C function: void mgl_set_range_dat (HMGL gr, char dir, const HCDT a, int add)
     Sets the range for x-,y-,z- coordinate or coloring (c) as minimal and maximal values of data DAT. Parameter add=on shows that the new range will be joined to existed one (not replace it).

 -- MGL command: ranges x1 x2 y1 y2 [z1=0 z2=0]
 -- Method on mglGraph: void SetRanges (mglPoint p1, mglPoint p2)
 -- Method on mglGraph: void SetRanges (double x1, double x2, double y1, double y2, double z1=0, double z2=0)
 -- C function: void mgl_set_ranges (HMGL gr, double x1, double x2, double y1, double y2, double z1, double z2)
     Sets the ranges of coordinates. If minimal and maximal values of the coordinate are the same then they are ignored. Also it sets the range for coloring (analogous to crange z1 z2). This is default color range for 2d plots. Initial ranges are [-1, 1].

 -- MGL command: ranges xx yy [zz cc=zz]
 -- Method on mglGraph: void SetRanges (const mglDataA &xx, const mglDataA &yy)
 -- Method on mglGraph: void SetRanges (const mglDataA &xx, const mglDataA &yy, const mglDataA &zz)
 -- Method on mglGraph: void SetRanges (const mglDataA &xx, const mglDataA &yy, const mglDataA &zz, const mglDataA &cc)
     Sets the ranges of x-,y-,z-,c-coordinates and coloring as minimal and maximal values of data XX, YY, ZZ, CC correspondingly.

 -- Method on mglGraph: void SetAutoRanges (mglPoint p1, mglPoint p2)
 -- Method on mglGraph: void SetAutoRanges (double x1, double x2, double y1, double y2, double z1=0, double z2=0, double c1=0, double c2=0)
 -- C function: void mgl_set_auto_ranges (HMGL gr, double x1, double x2, double y1, double y2, double z1, double z2, double z1, double z2)
     Sets the ranges for automatic coordinates. If minimal and maximal values of the coordinate are the same then they are ignored.

 -- MGL command: origin x0 y0 [z0=nan]
 -- Method on mglGraph: void SetOrigin (mglPoint p0)
 -- Method on mglGraph: void SetOrigin (mreal x0, mreal y0, mreal z0=NAN)
 -- C function: void mgl_set_origin (HMGL gr, mreal x0, mreal y0, mreal z0)
     Sets center of axis cross section. If one of values is NAN then MathGL try to select optimal axis position.

 -- MGL command: zoomaxis x1 x2
 -- MGL command: zoomaxis x1 y1 x2 y2
 -- MGL command: zoomaxis x1 y1 z1 x2 y2 z2
 -- MGL command: zoomaxis x1 y1 z1 c1 x2 y2 z2 c2
 -- Method on mglGraph: void ZoomAxis (mglPoint p1, mglPoint p2)
 -- C function: void mgl_zoom_axis (HMGL gr, mreal x1, mreal y1, mreal z1, mreal c1, mreal x2, mreal y2, mreal z2, mreal c2)
     Additionally extend axis range for any settings made by SetRange or SetRanges functions according the formula min += (max-min)*p1 and max += (max-min)*p1 (or min *= (max/min)^p1 and max *= (max/min)^p1 for log-axis range when inf>max/min>100 or 0<max/min<0.01). Initial ranges are [0, 1]. Attention! this settings can not be overwritten by any other functions, including DefaultPlotParam().

external

Curved coordinates
------------------

nav

 -- MGL command: axis 'fx' 'fy' 'fz' ['fa'='']
 -- Method on mglGraph: void SetFunc (const char *EqX, const char *EqY, const char *EqZ="", const char *EqA="")
 -- C function: void mgl_set_func (HMGL gr, const char *EqX, const char *EqY, const char *EqZ, const char *EqA)
     Sets transformation formulas for curvilinear coordinate. Each string should contain mathematical expression for real coordinate depending on internal coordinates x, y, z and a or c for colorbar. For example, the cylindrical coordinates are introduced as SetFunc("x*cos(y)", "x*sin(y)", "z");. For removing of formulas the corresponding parameter should be empty or NULL. Using transformation formulas will slightly slowing the program. Parameter EQA set the similar transformation formula for color scheme. See Textual formulas.

 -- MGL command: axis how
 -- Method on mglGraph: void SetCoor (int how)
 -- C function: void mgl_set_coor (HMGL gr, int how)
     Sets one of the predefined transformation formulas for curvilinear coordinate. Parameter HOW define the coordinates:

     mglCartesian=0
          Cartesian coordinates (no transformation, {x,y,z});

     mglPolar=1
          Polar coordinates: {x*cos(y), x*sin(y), z};

     mglSpherical=2
          Sperical coordinates: {x*sin(y)*cos(z), x*sin(y)*sin(z), x*cos(y)};

     mglParabolic=3
          Parabolic coordinates: {x*y, (x*x-y*y)/2, z}

     mglParaboloidal=4
          Paraboloidal coordinates: {(x*x-y*y)*cos(z)/2, (x*x-y*y)*sin(z)/2, x*y};

     mglOblate=5
          Oblate coordinates: {cosh(x)*cos(y)*cos(z), cosh(x)*cos(y)*sin(z), sinh(x)*sin(y)};

     mglProlate=6
          Prolate coordinates: {sinh(x)*sin(y)*cos(z), sinh(x)*sin(y)*sin(z), cosh(x)*cos(y)};

     mglElliptic=7
          Elliptic coordinates: {cosh(x)*cos(y), sinh(x)*sin(y), z};

     mglToroidal=8
          Toroidal coordinates: {sinh(x)*cos(z)/(cosh(x)-cos(y)), sinh(x)*sin(z)/(cosh(x)-cos(y)), sin(y)/(cosh(x)-cos(y))};

     mglBispherical=9
          Bispherical coordinates: {sin(y)*cos(z)/(cosh(x)-cos(y)), sin(y)*sin(z)/(cosh(x)-cos(y)), sinh(x)/(cosh(x)-cos(y))};

     mglBipolar=10
          Bipolar coordinates: {sinh(x)/(cosh(x)-cos(y)), sin(y)/(cosh(x)-cos(y)), z};

     mglLogLog=11
          Log-log coordinates: {lg(x), lg(y), lg(z)};

     mglLogX=12
          Log-x coordinates: {lg(x), y, z};

     mglLogY=13
          Log-y coordinates: {x, lg(y), z}.

 -- MGL command: ternary val
 -- Method on mglGraph: void Ternary (int tern)
 -- C function: void mgl_set_ternary (HMGL gr, int tern)
     The function sets to draws Ternary (TERN=1), Quaternary (TERN=2) plot or projections (TERN=4,5,6).

     Ternary plot is special plot for 3 dependent coordinates (components) A, B, C so that A+B+C=1. MathGL uses only 2 independent coordinates A=x and B=y since it is enough to plot everything. At this third coordinate z act as another parameter to produce contour lines, surfaces and so on.

     Correspondingly, Quaternary plot is plot for 4 dependent coordinates A, B, C and D so that A+B+C+D=1. MathGL uses only 3 independent coordinates A=x, B=y and D=z since it is enough to plot everything.

     Projections can be obtained by adding value 4 to TERN argument. So, that TERN=4 will draw projections in Cartesian coordinates, TERN=5 will draw projections in Ternary coordinates, TERN=6 will draw projections in Quaternary coordinates. If you add 8 instead of 4 then all text labels will not be printed  on projections.

     Use Ternary(0) for returning to usual axis. Ternary axis Axis projection

external

Ticks
-----

nav

 -- MGL command: adjust ['dir'='xyzc']
 -- Method on mglGraph: void Adjust (const char *dir="xyzc")
 -- C function: void mgl_adjust_ticks (HMGL gr, const char *dir)
     Set the ticks step, number of sub-ticks and initial ticks position to be the most human readable for the axis along direction(s) DIR. Also set SetTuneTicks(true). Usually you don't need to call this function except the case of returning to default settings.

 -- MGL command: xtick val [sub=0 org=nan 'fact'='']
 -- MGL command: ytick val [sub=0 org=nan 'fact'='']
 -- MGL command: ztick val [sub=0 org=nan 'fact'='']
 -- MGL command: xtick val sub ['fact'='']
 -- MGL command: ytick val sub ['fact'='']
 -- MGL command: ztick val sub ['fact'='']
 -- MGL command: ctick val ['fact'='']
 -- Method on mglGraph: void SetTicks (char dir, mreal d=0, int ns=0, mreal org=NAN, const char *fact="")
 -- Method on mglGraph: void SetTicks (char dir, mreal d, int ns, mreal org, const wchar_t *fact)
 -- C function: void mgl_set_ticks (HMGL gr, char dir, mreal d, int ns, mreal org)
 -- C function: void mgl_set_ticks_fact (HMGL gr, char dir, mreal d, int ns, mreal org, const char *fact)
 -- C function: void mgl_set_ticks_factw (HMGL gr, char dir, mreal d, int ns, mreal org, const wchar_t *fact)
     Set the ticks step D, number of sub-ticks NS (used for positive D) and initial ticks position ORG for the axis along direction DIR (use 'c' for colorbar ticks). Variable D set step for axis ticks (if positive) or it's number on the axis range (if negative). Zero value set automatic ticks. If ORG value is NAN then axis origin is used. Parameter FACT set text which will be printed after tick label (like "\pi" for D=M_PI).

 -- MGL command: xtick val1 'lbl1' [val2 'lbl2' ...]
 -- MGL command: ytick val1 'lbl1' [val2 'lbl2' ...]
 -- MGL command: ztick val1 'lbl1' [val2 'lbl2' ...]
 -- MGL command: ctick val1 'lbl1' [val2 'lbl2' ...]
 -- MGL command: xtick vdat 'lbls' [add=off]
 -- MGL command: ytick vdat 'lbls' [add=off]
 -- MGL command: ztick vdat 'lbls' [add=off]
 -- MGL command: ctick vdat 'lbls' [add=off]
 -- Method on mglGraph: void SetTicksVal (char dir, const char *lbl, bool add=false)
 -- Method on mglGraph: void SetTicksVal (char dir, const wchar_t *lbl, bool add=false)
 -- Method on mglGraph: void SetTicksVal (char dir, const mglDataA &val, const char *lbl, bool add=false)
 -- Method on mglGraph: void SetTicksVal (char dir, const mglDataA &val, const wchar_t *lbl, bool add=false)
 -- C function: void mgl_set_ticks_str (HMGL gr, char dir, const char *lbl, bool add)
 -- C function: void mgl_set_ticks_wcs (HMGL gr, char dir, const wchar_t *lbl, bool add)
 -- C function: void mgl_set_ticks_val (HMGL gr, char dir, HCDT val, const char *lbl, bool add)
 -- C function: void mgl_set_ticks_valw (HMGL gr, char dir, HCDT val, const wchar_t *lbl, bool add)
     Set the manual positions VAL and its labels LBL for ticks along axis DIR. If array VAL is absent then values equidistantly distributed in x-axis range are used. Labels are separated by \n symbol. If only one value is specified in MGL command then the label will be add to the current ones. Use SetTicks() to restore automatic ticks.

 -- Method on mglGraph: void AddTick (char dir, double val, const char *lbl)
 -- Method on mglGraph: void AddTick (char dir, double val, const wchar_t *lbl)
 -- C function: void mgl_add_tick (HMGL gr, char dir, double val, const char *lbl)
 -- C function: void mgl_set_tickw (HMGL gr, char dir, double val, const wchar_t *lbl)
     The same as previous but add single tick label LBL at position VAL to the list of existed ones.

 -- MGL command: xtick 'templ'
 -- MGL command: ytick 'templ'
 -- MGL command: ztick 'templ'
 -- MGL command: ctick 'templ'
 -- Method on mglGraph: void SetTickTempl (char dir, const char *templ)
 -- Method on mglGraph: void SetTickTempl (char dir, const wchar_t *templ)
 -- C function: void mgl_set_tick_templ (HMGL gr, const char *templ)
 -- C function: void mgl_set_tick_templw (HMGL gr, const wchar_t *templ)
     Set template TEMPL for x-,y-,z-axis ticks or colorbar ticks. It may contain TeX symbols also. If TEMPL="" then default template is used (in simplest case it is %.2g). If template start with & symbol then long integer value will be passed instead of default type double. Setting on template switch off automatic ticks tuning.

 -- MGL command: ticktime 'dir' [dv=0 'tmpl'='']
 -- Method on mglGraph: void SetTicksTime (char dir, mreal val, const char *templ)
 -- C function: void mgl_set_ticks_time (HMGL gr, mreal val, const char *templ)
     Sets time labels with step VAL and template TEMPL for x-,y-,z-axis ticks or colorbar ticks. It may contain TeX symbols also. The format of template TEMPL is the same as described in http://www.manpagez.com/man/3/strftime/. Most common variants are %X for national representation of time, %x for national representation of date, %Y for year with century. If VAL=0 and/or TEMPL="" then automatic tick step and/or template will be selected. You can use mgl_get_time() function for obtaining number of second for given date/time string. Note, that MS Visual Studio couldn't handle date before 1970.

 -- C function: double mgl_get_time (const char*str, const char *templ)
     Gets number of seconds from 1970 year to specified date/time STR. The format of string is specified by TEMPL, which is the same as described in http://www.manpagez.com/man/3/strftime/. Most common variants are %X for national representation of time, %x for national representation of date, %Y for year with century. Note, that MS Visual Studio couldn't handle date before 1970.

 -- MGL command: tuneticks val [pos=1.15]
 -- Method on mglGraph: void SetTuneTicks (int tune, mreal pos=1.15)
 -- C function: void mgl_tune_ticks (HMGL gr, int tune, mreal pos)
     Switch on/off ticks enhancing by factoring common multiplier (for small, like from 0.001 to 0.002, or large, like from 1000 to 2000, coordinate values -- enabled if TUNE&1 is nonzero) or common component (for narrow range, like from 0.999 to 1.000 -- enabled if TUNE&2 is nonzero). Also set the position POS of common multiplier/component on the axis: =0 at minimal axis value, =1 at maximal axis value. Default value is 1.15.

 -- MGL command: tickshift dx [dy=0 dz=0 dc=0]
 -- Method on mglGraph: void SetTickShift (mglPoint d)
 -- C function: void mgl_set_tick_shift (HMGL gr, mreal dx, mreal dy, mreal dz, mreal dc)
     Set value of additional shift for ticks labels.

 -- Method on mglGraph: void SetTickRotate (bool val)
 -- C function: void mgl_set_tick_rotate (HMGL gr, bool val)
     Enable/disable ticks rotation if there are too many ticks or ticks labels are too long.

 -- Method on mglGraph: void SetTickSkip (bool val)
 -- C function: void mgl_set_tick_skip (HMGL gr, bool val)
     Enable/disable ticks skipping if there are too many ticks or ticks labels are too long.

 -- Method on mglGraph: void SetTimeUTC (bool val)
     Enable/disable using UTC time for ticks labels. In C/Fortran you can use mgl_set_flag(gr,val, MGL_USE_GMTIME);.

 -- MGL command: origintick val
 -- Method on mglGraph: void SetOriginTick (bool val=true)
     Enable/disable drawing of ticks labels at axis origin. In C/Fortran you can use mgl_set_flag(gr,val, MGL_NO_ORIGIN);.

 -- MGL command: ticklen val [stt=1]
 -- Method on mglGraph: void SetTickLen (mreal val, mreal stt=1)
 -- C function: void mgl_set_tick_len (HMGL gr, mreal val, mreal stt)
     The relative length of axis ticks. Default value is 0.1. Parameter STT>0 set relative length of subticks which is in sqrt(1+stt) times smaller.

 -- MGL command: axisstl 'stl' ['tck'='' 'sub'='']
 -- Method on mglGraph: void SetAxisStl (const char *stl="k", const char *tck=0, const char *sub=0)
 -- C function: void mgl_set_axis_stl (HMGL gr, const char *stl, const char *tck, const char *sub)
     The line style of axis (STL), ticks (TCK) and subticks (SUB). If STL is empty then default style is used (k or w depending on transparency type). If TCK or SUB is empty then axis style is used (i.e. STL).

external

Subplots and rotation
=====================

nav

These functions control how and where further plotting will be placed. There is a certain calling order of these functions for the better plot appearance. First one should be subplot, multiplot or inplot for specifying the place. Second one can be title for adding title for the subplot. After it a rotate, shear and aspect. And finally any other plotting functions may be called. Alternatively you can use columnplot, gridplot, stickplot, shearplot or relative inplot for positioning plots in the column (or grid, or stick) one by another without gap between plot axis (bounding boxes). Subplots

 -- MGL command: subplot nx ny m ['stl'='<>_^' dx=0 dy=0]
 -- Method on mglGraph: void SubPlot (int nx, int ny, int m, const char *stl="<>_^", mreal dx=0, mreal dy=0)
 -- C function: void mgl_subplot (HMGL gr, int nx, int ny, int m, const char *stl)
 -- C function: void mgl_subplot_d (HMGL gr, int nx, int ny, int m, const char *stl, mreal dx, mreal dy)
     Puts further plotting in a M-th cell of NX*NY grid of the whole frame area. The position of the cell can be shifted from its default position by relative size DX, DY. This function set off any aspects or rotations. So it should be used first for creating the subplot. Extra space will be reserved for axis/colorbar if STL contain:

       * L or < -- at left side,

       * R or > -- at right side,

       * A or ^ -- at top side,

       * U or _ -- at bottom side,

       * # -- reserve none space (use whole region for axis range) -- axis and tick labels will be invisible by default.

     From the aesthetical point of view it is not recommended to use this function with different matrices in the same frame. Note, colorbar can be invisible (be out of image borders) if you set empty style.

 -- MGL command: multiplot nx ny m dx dy ['style'='<>_^' sx sy]
 -- Method on mglGraph: void MultiPlot (int nx, int ny, int m, int dx, int dy, const char *stl="<>_^")
 -- C function: void mgl_multiplot (HMGL gr, int nx, int ny, int m, int dx, int dy, const char *stl)
     Puts further plotting in a rectangle of DX*DY cells starting from M-th cell of NX*NY grid of the whole frame area. The position of the rectangular area can be shifted from its default position by relative size SX, SY. This function set off any aspects or rotations.  So it should be used first for creating subplot. Extra space will be reserved for axis/colorbar if STL contain:

       * L or < -- at left side,

       * R or > -- at right side,

       * A or ^ -- at top side,

       * U or _ -- at bottom side. # -- reserve none space (use whole region for axis range) -- axis and tick labels will be invisible by default.

 -- MGL command: inplot x1 x2 y1 y2 [rel=on]
 -- Method on mglGraph: void InPlot (mreal x1, mreal x2, mreal y1, mreal y2, bool rel=true)
 -- C function: void mgl_inplot (HMGL gr, mreal x1, mreal x2, mreal y1, mreal y2)
 -- C function: void mgl_relplot (HMGL gr, mreal x1, mreal x2, mreal y1, mreal y2)
     Puts further plotting in some region of the whole frame surface. This function allows one to create a plot in arbitrary place of the screen. The position is defined by rectangular coordinates [X1, X2]*[Y1, Y2]. The coordinates X1, X2, Y1, Y2 are normalized to interval [0, 1]. If parameter REL=true then the relative position to current subplot (or inplot with REL=false) is used. This function set off any aspects or rotations. So it should be used first for creating subplot.

 -- MGL command: columnplot num ind [d=0]
 -- Method on mglGraph: void ColumnPlot (int num, int ind, mreal d=0)
 -- C function: void mgl_columnplot (HMGL gr, int num, int ind)
 -- C function: void mgl_columnplot_d (HMGL gr, int num, int ind, mreal d)
     Puts further plotting in IND-th cell of column with NUM cells. The position is relative to previous subplot (or inplot with REL=false). Parameter D set extra gap between cells.

 -- MGL command: gridplot nx ny ind [d=0]
 -- Method on mglGraph: void GridPlot (int nx, int ny, int ind, mreal d=0)
 -- C function: void mgl_gridplot (HMGL gr, int nx, int ny, int ind)
 -- C function: void mgl_gridplot_d (HMGL gr, int nx, int ny, int ind, mreal d)
     Puts further plotting in IND-th cell of NX*NY grid. The position is relative to previous subplot (or inplot with REL=false). Parameter D set extra gap between cells.

 -- MGL command: stickplot num ind tet phi
 -- Method on mglGraph: void StickPlot (int num, int ind, mreal tet, mreal phi)
 -- C function: void mgl_stickplot (HMGL gr, int num, int ind, mreal tet, mreal phi)
     Puts further plotting in IND-th cell of stick with NUM cells. At this, stick is rotated on angles TET, PHI. The position is relative to previous subplot (or inplot with REL=false).

 -- MGL command: shearplot num ind sx sy [xd yd]
 -- Method on mglGraph: void ShearPlot (int num, int ind, mreal sx, mreal sy, mreal xd=1, mreal yd=0)
 -- C function: void mgl_shearplot (HMGL gr, int num, int ind, mreal sx, mreal sy, mreal xd, mreal yd)
     Puts further plotting in IND-th cell of stick with NUM cells. At this, cell is sheared on values SX, SY. Stick direction is specified be XD and YD. The position is relative to previous subplot (or inplot with REL=false).

 -- MGL command: title 'title' ['stl'='' size=-2]
 -- Method on mglGraph: void Title (const char *txt, const char *stl="", mreal size=-2)
 -- Method on mglGraph: void Title (const wchar_t *txt, const char *stl="", mreal size=-2)
 -- C function: void mgl_title (HMGL gr, const char *txt, const char *stl, mreal size)
 -- C function: void mgl_titlew (HMGL gr, const wchar_t *txt, const char *stl, mreal size)
     Add text TITLE for current subplot/inplot. Parameter STL can contain:

       * font style (see, Font styles);

       * # for box around the title.

     Parameter SIZE set font size. This function set off any aspects or rotations. So it should be used just after creating subplot. Note, that each call of this command will reserve extra space. So, you need to manually call subplot command after rasterize if you want to combine bitmap and vector graphics.

 -- MGL command: rotate tetx tetz [tety=0]
 -- Method on mglGraph: void Rotate (mreal TetX, mreal TetZ, mreal TetY=0)
 -- C function: void mgl_rotate (HMGL gr, mreal TetX, mreal TetZ, mreal TetY)
     Rotates a further plotting relative to each axis {x, z, y} consecutively on angles TETX, TETZ, TETY.

 -- MGL command: rotate tet x y z
 -- Method on mglGraph: void RotateN (mreal Tet, mreal x, mreal y, mreal z)
 -- C function: void mgl_rotate_vector (HMGL gr, mreal Tet, mreal x, mreal y, mreal z)
     Rotates a further plotting around vector {X, Y, Z} on angle TET.

 -- MGL command: shear sx sy
 -- Method on mglGraph: void Shear (mreal sx, mreal sy)
 -- C function: void mgl_shear (HMGL gr, mreal sx, mreal sy)
     Shears a further plotting on values SX, SY.

 -- MGL command: aspect ax ay [az=1]
 -- Method on mglGraph: void Aspect (mreal Ax, mreal Ay, mreal Az=1)
 -- C function: void mgl_aspect (HMGL gr, mreal Ax, mreal Ay, mreal Az)
     Defines aspect ratio for the plot. The viewable axes will be related one to another as the ratio AX:AY:AZ. For the best effect it should be used after rotate function. If AX is NAN then function try to select optimal aspect ratio to keep equal ranges for x-y axis. At this, AY will specify proportionality factor, or set to use automatic one if AY=NAN.

 -- Method on mglGraph: void Push ()
 -- C function: void mgl_mat_push (HMGL gr)
     Push transformation matrix into stack. Later you can restore its current state by Pop() function.

 -- Method on mglGraph: void Pop ()
 -- C function: void mgl_mat_pop (HMGL gr)
     Pop (restore last 'pushed') transformation matrix into stack.

 -- Method on mglGraph: void SetPlotFactor (mreal val)
 -- C function: void mgl_set_plotfactor (HMGL gr, mreal val)
     Sets the factor of plot size. It is not recommended to set it lower then 1.5. This is some analogue of function Zoom() but applied not to overall image but for each InPlot. Use negative value or zero to enable automatic selection.

There are 3 functions View(), Zoom() and Perspective() which transform whole image. I.e. they act as secondary transformation matrix. They were introduced for rotating/zooming the whole plot by mouse. It is not recommended to call them for picture drawing.

 -- MGL command: perspective val
 -- Method on mglGraph: void Perspective (mreal a)
 -- C function: void mgl_perspective (HMGL gr, mreal a)
     Add (switch on) the perspective to plot. The parameter a = Depth/(Depth+dz) \in [0,1). By default (a=0) the perspective is off.

 -- MGL command: view tetx tetz [tety=0]
 -- Method on mglGraph: void View (mreal TetX, mreal TetZ, mreal TetY=0)
 -- C function: void mgl_view (HMGL gr, mreal TetX, mreal TetZ, mreal TetY)
     Rotates a further plotting relative to each axis {x, z, y} consecutively on angles TETX, TETZ, TETY. Rotation is done independently on rotate. Attention! this settings can not be overwritten by DefaultPlotParam(). Use Zoom(0,0,1,1) to return default view.

 -- MGL command: zoom x1 y1 x2 y2
 -- Method on mglGraph (C++, Python): void Zoom (mreal x1, mreal y1, mreal x2, mreal y2)
 -- C function: void mgl_set_zoom (HMGL gr, mreal x1, mreal y1, mreal x2, mreal y2)
     The function changes the scale of graphics that correspond to zoom in/out of the picture. After function call the current plot will be cleared and further the picture will contain plotting from its part [x1,x2]*[y1,y2]. Here picture coordinates X1, X2, Y1, Y2 changes from 0 to 1. Attention! this settings can not be overwritten by any other functions, including DefaultPlotParam(). Use Zoom(0,0,1,1) to return default view.

external

Export picture
==============

nav

Functions in this group save or give access to produced picture. So, usually they should be called after plotting is done.

 -- MGL command: setsize w h
 -- Method on mglGraph: void SetSize (int width, int height, bool clear=true)
 -- C function: void mgl_set_size (HMGL gr, int width, int height)
 -- C function: void mgl_scale_size (HMGL gr, int width, int height)
     Sets size of picture in pixels. This function should be called before any other plotting because it completely remove picture contents if CLEAR=true. Function just clear pixels and scale all primitives if CLEAR=false.

 -- MGL command: setsizescl factor
 -- Method on mglGraph: void SetSizeScl (double factor)
 -- C function: void mgl_set_size_scl (HMGL gr, double factor)
     Set factor for width and height in all further calls of setsize. This command is obsolete since v.2.4.2.

 -- MGL command: quality [val=2]
 -- Method on mglGraph: void SetQuality (int val=MGL_DRAW_NORM)
 -- C function: void mgl_set_quality (HMGL gr, int val)
     Sets quality of the plot depending on value VAL: MGL_DRAW_WIRE=0 -- no face drawing (fastest), MGL_DRAW_FAST=1 -- no color interpolation (fast), MGL_DRAW_NORM=2 -- high quality (normal), MGL_DRAW_HIGH=3 -- high quality with 3d primitives (arrows and marks); MGL_DRAW_LMEM=0x4 -- direct bitmap drawing (low memory usage); MGL_DRAW_DOTS=0x8 -- for dots drawing instead of primitives (extremely fast).

 -- Method on mglGraph: int GetQuality ()
 -- C function: int mgl_get_quality (HMGL gr)
     Gets quality of the plot: MGL_DRAW_WIRE=0 -- no face drawing (fastest), MGL_DRAW_FAST=1 -- no color interpolation (fast), MGL_DRAW_NORM=2 -- high quality (normal), MGL_DRAW_HIGH=3 -- high quality with 3d primitives (arrows and marks); MGL_DRAW_LMEM=0x4 -- direct bitmap drawing (low memory usage); MGL_DRAW_DOTS=0x8 -- for dots drawing instead of primitives (extremely fast).

 -- Method on mglGraph: void StartGroup (const char *name)
 -- C function: void mgl_start_group (HMGL gr, const char *name)
     Starts group definition. Groups contain objects and other groups, they are used to select a part of a model to zoom to or to make invisible or to make semitransparent and so on.

 -- Method on mglGraph: void EndGroup ()
 -- C function: void mgl_end_group (HMGL gr)
     Ends group definition.

external

Export to file
--------------

nav

These functions export current view to a graphic file. The filename FNAME should have appropriate extension. Parameter DESCR gives the short description of the picture. Just now the transparency is supported in PNG, SVG, OBJ and PRC files.

 -- MGL command: write ['fname'='']
 -- Method on mglGraph: void WriteFrame (const char *fname="", const char *descr="")
 -- C function: void mgl_write_frame (HMGL gr, const char *fname, const char *descr)
     Exports current frame to a file FNAME which type is determined by the extension. Parameter DESCR adds description to file (can be ""). If FNAME="" then the file frame####.jpg is used, where #### is current frame id and name frame is defined by plotid class property.

 -- MGL command: bbox x1 y1 [x2=-1 y2=-1]
 -- Method on mglGraph: void SetBBox (int x1=0, int y1=0, int x2=-1, int y2=-1)
 -- C function: void mgl_set_bbox (HMGL gr, int x1, int y1, int x2, int y2)
     Set boundary box for export graphics into 2D file formats. If X2<0 (Y2<0) then original image width (height) will be used. If X1<0 or Y1<0 or X1>=X2|Width or Y1>=Y2|Height then cropping will be disabled.

 -- Method on mglGraph: void WritePNG (const char *fname, const char *descr="", int compr="", bool alpha=true)
 -- C function: void mgl_write_png (HMGL gr, const char *fname, const char *descr)
 -- C function: void mgl_write_png_solid (HMGL gr, const char *fname, const char *descr)
     Exports current frame to PNG file. Parameter FNAME specifies the file name, DESCR adds description to file, ALPHA gives the transparency type. By default there are no description added and semitransparent image used. This function does nothing if HAVE_PNG isn't defined during compilation of MathGL library.

 -- Method on mglGraph: void WriteJPEG (const char *fname, const char *descr="")
 -- C function: void mgl_write_jpg (HMGL gr, const char *fname, const char *descr)
     Exports current frame to JPEG file. Parameter FNAME specifies the file name, DESCR adds description to file. By default there is no description added. This function does nothing if HAVE_JPEG isn't defined during compilation of MathGL library.

 -- Method on mglGraph: void WriteGIF (const char *fname, const char *descr="")
 -- C function: void mgl_write_gif (HMGL gr, const char *fname, const char *descr)
     Exports current frame to GIF file. Parameter FNAME specifies the file name, DESCR adds description to file. By default there is no description added. This function does nothing if HAVE_GIF isn't defined during compilation of MathGL library.

 -- Method on mglGraph: void WriteBMP (const char *fname, const char *descr="")
 -- C function: void mgl_write_bmp (HMGL gr, const char *fname, const char *descr)
     Exports current frame to BMP file. Parameter FNAME specifies the file name, DESCR adds description to file. There is no compression used.

 -- Method on mglGraph: void WriteTGA (const char *fname, const char *descr="")
 -- C function: void mgl_write_tga (HMGL gr, const char *fname, const char *descr)
     Exports current frame to TGA file. Parameter FNAME specifies the file name, DESCR adds description to file. There is no compression used.

 -- Method on mglGraph: void WriteEPS (const char *fname, const char *descr="")
 -- C function: void mgl_write_eps (HMGL gr, const char *fname, const char *descr)
     Exports current frame to EPS file using vector representation. So it is not recommended for the export of large data plot. It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter FNAME specifies the file name, DESCR adds description to file. By default there is no description added. If file name is terminated by z (for example, fname.eps.gz) then file will be compressed in gzip format. Note, that EPS format don't support color interpolation, and the resulting plot will look as you use quality=1 for plotting.

 -- Method on mglGraph: void WriteBPS (const char *fname, const char *descr="")
 -- C function: void mgl_write_eps (HMGL gr, const char *fname, const char *descr)
     Exports current frame to EPS file using bitmap representation. Parameter FNAME specifies the file name, DESCR adds description to file. By default there is no description added. If file name is terminated by z (for example, fname.eps.gz) then file will be compressed in gzip format.

 -- Method on mglGraph: void WriteSVG (const char *fname, const char *descr="")
 -- C function: void mgl_write_svg (HMGL gr, const char *fname, const char *descr)
     Exports current frame to SVG (Scalable Vector Graphics) file using vector representation. In difference of EPS format, SVG format support transparency that allows to correctly draw semitransparent plot (like surfa, surf3a or cloud). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter FNAME specifies the file name, DESCR adds description to file (default is file name). If file name is terminated by z (for example, fname.svgz) then file will be compressed in gzip format. Note, that SVG format don't support color interpolation, and the resulting plot will look as you use quality=1 for plotting.

 -- Method on mglGraph: void WriteTEX (const char *fname, const char *descr="")
 -- C function: void mgl_write_tex (HMGL gr, const char *fname, const char *descr)
     Exports current frame to LaTeX (package Tikz/PGF) file using vector representation. Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter FNAME specifies the file name, DESCR adds description to file (default is file name). Note, there is no text scaling now (for example, in subplots), what may produce miss-aligned labels.

 -- Method on mglGraph: void WritePRC (const char *fname, const char *descr="", bool make_pdf=true)
 -- C function: void mgl_write_prc (HMGL gr, const char *fname, const char *descr, int make_pdf)
     Exports current frame to PRC file using vector representation (see http://en.wikipedia.org/wiki/PRC_%28file_format%29). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter FNAME specifies the file name, DESCR adds description to file (default is file name). If parameter MAKE_PDF=true and PDF was enabled at MathGL configure then corresponding PDF file with 3D image will be created.

 -- Method on mglGraph: void WriteOBJ (const char *fname, const char *descr="")
 -- C function: void mgl_write_obj (HMGL gr, const char *fname, const char *descr)
     Exports current frame to OBJ/MTL file using vector representation (see OBJ format (http://en.wikipedia.org/wiki/Wavefront_.obj_file) for details). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter FNAME specifies the file name, DESCR adds description to file (default is file name).

 -- Method on mglGraph: void WriteXYZ (const char *fname, const char *descr="")
 -- C function: void mgl_write_xyz (HMGL gr, const char *fname, const char *descr)
     Exports current frame to XYZ/XYZL/XYZF files using vector representation (see XYZ format (http://people.sc.fsu.edu/~jburkardt/data/xyz/xyz.html) for details). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter FNAME specifies the file name, DESCR adds description to file (default is file name).

 -- Method on mglGraph: void WriteSTL (const char *fname, const char *descr="")
 -- C function: void mgl_write_stl (HMGL gr, const char *fname, const char *descr)
     Exports current frame to STL file using vector representation (see STL format (http://en.wikipedia.org/wiki/STL_(file_format)) for details). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter FNAME specifies the file name, DESCR adds description to file (default is file name.

 -- Method on mglGraph: void WriteOFF (const char *fname, const char *descr="", bool colored=false)
 -- C function: void mgl_write_off (HMGL gr, const char *fname, const char *descr, bool colored)
     Exports current frame to OFF file using vector representation (see OFF format (http://people.sc.fsu.edu/~jburkardt/data/off/off.html) for details). Note, the output file may be too large for graphic of large data array (especially for surfaces). It is better to use bitmap format (for example PNG or JPEG). However, program has no internal limitations for size of output file. Parameter FNAME specifies the file name, DESCR adds description to file (default is file name).

 -- Method on mglGraph: void ShowImage (const char *viewer, bool nowait=false)
 -- C function: void mgl_show_image (const char *viewer, int nowait)
     Displays the current picture using external program VIEWER for viewing. The function save the picture to temporary file and call VIEWER to display it. If NOWAIT=true then the function return immediately (it will not wait while window will be closed).

 -- Method on mglGraph: void WriteJSON (const char *fname, const char *descr="")
 -- C function: void mgl_write_json (HMGL gr, const char *fname, const char *descr)
     Exports current frame to textual file using JSON format. Later this file can be used for faster loading and viewing by JavaScript script. Parameter FNAME specifies the file name, DESCR adds description to file.

 -- Method on mglGraph: void ExportMGLD (const char *fname, const char *descr="")
 -- C function: void mgl_export_mgld (HMGL gr, const char *fname, const char *descr)
     Exports points and primitives in file using MGLD format. Later this file can be used for faster loading and viewing by mglview utility. Parameter FNAME specifies the file name, DESCR adds description to file (default is file name).

 -- Method on mglGraph: void ImportMGLD (const char *fname, bool add=false)
 -- C function: void mgl_import_mgld (HMGL gr, const char *fname, int add)
     Imports points and primitives in file using MGLD format. Later this file can be used for faster loading and viewing by mglview utility. Parameter FNAME specifies the file name, ADD sets to append or replace primitives to existed ones.

external

Frames/Animation
----------------

nav

These functions provide ability to create several pictures simultaneously. For most of cases it is useless but for widget classes (see Widget classes) they can provide a way to show animation. Also you can write several frames into animated GIF file.

 -- Method on mglGraph: void NewFrame ()
 -- C function: void mgl_new_frame (HMGL gr)
     Creates new frame. Function returns current frame id. This is not thread safe function in OpenGL mode! Use direct list creation in multi-threading drawing. The function EndFrame() must be call after the finishing of the frame drawing for each call of this function.

 -- Method on mglGraph: void EndFrame ()
 -- C function: void mgl_end_frame (HMGL gr)
     Finishes the frame drawing.

 -- Method on mglGraph: int GetNumFrame ()
 -- C function: int mgl_get_num_frame (HMGL gr)
     Gets the number of created frames.

 -- Method on mglGraph: void SetFrame (int i)
 -- C function: void mgl_set_frame (HMGL gr, int i)
     Finishes the frame drawing and sets drawing data to frame I, which should be in range [0, GetNumFrame()-1]. This function is similar to EndFrame() but don't add frame to the GIF image.

 -- Method on mglGraph: void GetFrame (int i)
 -- C function: void mgl_get_frame (HMGL gr, int i)
     Replaces drawing data by one from frame I. Function work if MGL_VECT_FRAME is set on (by default).

 -- Method on mglGraph: void ShowFrame (int i)
 -- C function: void mgl_show_frame (HMGL gr, int i)
     Appends drawing data from frame I to current one. Function work if MGL_VECT_FRAME is set on (by default).

 -- Method on mglGraph: void DelFrame (int i)
 -- C function: void mgl_del_frame (HMGL gr, int i)
     Deletes drawing data for frame I and shift all later frame indexes. Function work if MGL_VECT_FRAME is set on (by default). Do nothing in OpenGL mode.

 -- Method on mglGraph: void ResetFrames ()
 -- C function: void mgl_reset_frames (HMGL gr)
     Reset frames counter (start it from zero).

 -- Method on mglGraph: void ClearFrame (int i)
 -- C function: void mgl_clear_frame (HMGL gr, int i)
     Clear list of primitives for current drawing.

 -- Method on mglGraph: void StartGIF (const char *fname, int ms=100)
 -- C function: void mgl_start_gif (HMGL gr, const char *fname, int ms)
     Start writing frames into animated GIF file FNAME. Parameter MS set the delay between frames in milliseconds. You should not change the picture size during writing the cinema. Use CloseGIF() to finalize writing. Note, that this function is disabled in OpenGL mode.

 -- Method on mglGraph: void CloseGIF ()
 -- C function: void mgl_close_gif (HMGL gr)
     Finish writing animated GIF and close connected pointers.

external

Bitmap in memory
----------------

nav

These functions return the created picture (bitmap), its width and height. You may display it by yourself in any graphical library (see also, Widget classes) or save in file (see also, Export to file).

 -- Method on mglGraph: const unsigned char * GetRGB ()
 -- Method on mglGraph: void GetRGB (char *buf, int size)
 -- Method on mglGraph: void GetBGRN (char *buf, int size)
 -- C function: const unsigned char * mgl_get_rgb (HMGL gr)
     Gets RGB bitmap of the current state of the image. Format of each element of bits is: {red, green, blue}. Number of elements is Width*Height. Position of element {i,j} is [3*i + 3*Width*j] (or is [4*i + 4*Width*j] for GetBGRN()). You have to provide the proper SIZE of the buffer, BUF, i.e. the code for Python should look like
     from mathgl import *
     gr = mglGraph();
     bits='\t';
     bits=bits.expandtabs(4*gr.GetWidth()*gr.GetHeight());
     gr.GetBGRN(bits, len(bits));

 -- Method on mglGraph: const unsigned char * GetRGBA ()
 -- Method on mglGraph: void GetRGBA (char *buf, int size)
 -- C function: const unsigned char * mgl_get_rgba (HMGL gr)
     Gets RGBA bitmap of the current state of the image. Format of each element of bits is: {red, green, blue, alpha}. Number of elements is Width*Height. Position of element {i,j} is [4*i + 4*Width*j].

 -- Method on mglGraph: int GetWidth ()
 -- Method on mglGraph: int GetHeight ()
 -- C function: int mgl_get_width (HMGL gr)
 -- C function: int mgl_get_height (HMGL gr)
     Gets width and height of the image.

 -- Method on mglGraph: mglPoint CalcXYZ (int xs, int ys)
 -- C function: void mgl_calc_xyz (HMGL gr, int xs, int ys, mreal *x, mreal *y, mreal *z)
     Calculate 3D coordinate {x,y,z} for screen point {xs,ys}. At this moment it ignore perspective and transformation formulas (curvilinear coordinates). The calculation are done for the last used InPlot (see Subplots and rotation).

 -- Method on mglGraph: mglPoint CalcScr (mglPoint p)
 -- C function: void mgl_calc_scr (HMGL gr, mreal x, mreal y, mreal z, int *xs, int *ys)
     Calculate screen point {xs,ys} for 3D coordinate {x,y,z}. The calculation are done for the last used InPlot (see Subplots and rotation).

 -- Method on mglGraph: void SetObjId (int id)
 -- C function: void mgl_set_obj_id (HMGL gr, int id)
     Set the numeric id for object or subplot/inplot.

 -- Method on mglGraph: int GetObjId (int xs, int ys)
 -- C function: int mgl_get_obj_id (HMGL gr, int xs, int ys)
     Get the numeric id for most upper object at pixel {xs, ys} of the picture. Note, that all plots in the same line of MGL script have the same id.

 -- Method on mglGraph: int GetSplId (int xs, int ys)
 -- C function: int mgl_get_spl_id (HMGL gr, int xs, int ys)
     Get the numeric id for most subplot/inplot at pixel {xs, ys} of the picture.

 -- Method on mglGraph: void Highlight (int id)
 -- C function: void mgl_highlight (HMGL gr, int id)
     Highlight the object with given ID.

 -- Method on mglGraph: long IsActive (int xs, int ys, int d=1)
 -- C function: long mgl_is_active (HMGL gr, int xs, int ys, int d)
     Checks if point {XS, YS} is close to one of active point (i.e. mglBase::Act) with accuracy D and return its index or -1 if not found. Active points are special points which characterize primitives (like edges and so on). This function for advanced users only.

 -- Method on mglGraph: long SetDrawReg (int nx=1, int ny=1, int m=0)
 -- C function: long mgl_set_draw_reg (HMGL gr, int nx, int ny, int m)
     Limits drawing region by rectangular area of M-th cell of matrix with sizes NX*NY (like in subplot). This function can be used to update only small region of the image for purposes of higher speed. This function for advanced users only.

external

Parallelization
---------------

nav

Many of things MathGL do in parallel by default (if MathGL was built with pthread). However, there is function which set the number of threads to be used.

 -- C function: int mgl_set_num_thr (int n)
     Set the number of threads to be used by MathGL. If N<1 then the number of threads is set as maximal number of processors (cores). If N=1 then single thread will be used (this is default if pthread was disabled).

Another option is combining bitmap image (taking into account Z-ordering) from different instances of  mglGraph. This method is most appropriate for computer clusters when the data size is so large that it exceed the memory of single computer node.

 -- Method on mglGraph: int Combine (const mglGraph *g)
 -- C function: int mgl_combine_gr (HMGL gr, HMGL g)
     Combine drawing from instance G with GR (or with this) taking into account Z-ordering of pixels. The width and height of both instances must be the same.

 -- Method on mglGraph: int MPI_Send (int id)
 -- C function: int mgl_mpi_send (HMGL gr, int id)
     Send graphical information from node ID using MPI. The width and height in both nodes must be the same.

 -- Method on mglGraph: int MPI_Recv (int id)
 -- C function: int mgl_mpi_send (HMGL gr, int id)
     Receive graphical information from node ID using MPI. The width and height in both nodes must be the same.

external

Background
==========

nav

These functions change background image.

 -- MGL command: clf ['col']
 -- MGL command: clf r g b
 -- Method on mglGraph: void Clf ()
 -- Method on mglGraph: void Clf (const char * col)
 -- Method on mglGraph: void Clf (char col)
 -- Method on mglGraph: void Clf (mreal r, mreal g, mreal b)
 -- C function: void mgl_clf (HMGL gr)
 -- C function: void mgl_clf_str (HMGL gr, const char * col)
 -- C function: void mgl_clf_chr (HMGL gr, char col)
 -- C function: void mgl_clf_rgb (HMGL gr, mreal r, mreal g, mreal b)
     Clear the picture and fill background by specified color.

 -- MGL command: rasterize
 -- Method on mglGraph: void Rasterize ()
 -- C function: void mgl_rasterize (HMGL gr)
     Force drawing the plot and use it as background. After it, function clear the list of primitives, like clf. This function is useful if you want save part of plot as bitmap one (for example, large surfaces, isosurfaces or vector fields) and keep some parts as vector one (like annotation, curves, axis and so on). Often, you need to manually call subplot command after rasterize to avoid extra space allocation or plot rotation.

 -- MGL command: background 'fname' [alpha=1]
 -- MGL command: background 'fname' 'how' [alpha=1]
 -- Method on mglGraph: void LoadBackground (const char * fname, double alpha=1)
 -- C function: void mgl_load_background (HMGL gr, const char * fname, double alpha)
 -- Method on mglGraph: void LoadBackground (const char * fname, const char * how, double alpha=1)
 -- C function: void mgl_load_background_ext (HMGL gr, const char * fname, const char * how, double alpha)
     Load PNG or JPEG file FNAME as background for the plot. Parameter ALPHA manually set transparency of the background. Parameter HOW can be: a for filling current subplot only, s for scaling (resizing) image to whole area, c for centering image, m for tessellate image as mosaic.

 -- MGL command: background r g b
 -- Method on mglGraph: void FillBackground (const mglColor &rgb)
 -- C function: void mgl_fill_background (HMGL gr, double r, double g, double b)
     Fill background by the specified color. Values should be in range [0,1].

external

Primitives
==========

nav

These functions draw some simple objects like line, point, sphere, drop, cone and so on. Using primitives

 -- MGL command: ball x y ['col'='r.']
 -- MGL command: ball x y z ['col'='r.']
 -- Method on mglGraph: void Ball (mglPoint p, char col='r')
 -- Method on mglGraph: void Mark (mglPoint p, const char *mark)
 -- C function: void mgl_mark (HMGL gr, mreal x, mreal y, mreal z, const char *mark)
     Draws a mark (point . by default) at position P={X, Y, Z} with color COL.

 -- MGL command: errbox x y ex ey ['stl'='']
 -- MGL command: errbox x y z ex ey ez ['stl'='']
 -- Method on mglGraph: void Error (mglPoint p, mglPoint e, char *stl="")
 -- C function: void mgl_error_box (HMGL gr, mreal x, mreal y, mreal z, mreal ex, mreal ey, mreal ez, char *stl)
     Draws a 3d error box at position P={X, Y, Z} with sizes E={EX, EY, EZ} and style STL. Use NAN for component of E to reduce number of drawn elements.

 -- MGL command: line x1 y1 x2 y2 ['stl'='']
 -- MGL command: line x1 y1 z1 x2 y2 z2 ['stl'='']
 -- Method on mglGraph: void Line (mglPoint p1, mglPoint p2, char *stl="B", int num=2)
 -- C function: void mgl_line (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, char *stl, int num)
     Draws a geodesic line (straight line in Cartesian coordinates) from point P1 to P2 using line style STL. Parameter NUM define the ``quality'' of the line. If NUM=2 then the straight line will be drawn in all coordinate system (independently on transformation formulas (see Curved coordinates). Contrary, for large values (for example, =100) the geodesic line will be drawn in corresponding coordinate system (straight line in Cartesian coordinates, circle in polar coordinates and so on). Line will be drawn even if it lies out of bounding box.

 -- MGL command: curve x1 y1 dx1 dy1 x2 y2 dx2 dy2 ['stl'='']
 -- MGL command: curve x1 y1 z1 dx1 dy1 dz1 x2 y2 z2 dx2 dy2 dz2 ['stl'='']
 -- Method on mglGraph: void Curve (mglPoint p1, mglPoint d1, mglPoint p2, mglPoint d2, const char *stl="B", int num=100)
 -- C function: void mgl_curve (HMGL gr, mreal x1, mreal y1, mreal z1, mreal dx1, mreal dy1, mreal dz1, mreal x2, mreal y2, mreal z2, mreal dx2, mreal dy2, mreal dz2, const char *stl, int num)
     Draws Bezier-like curve from point P1 to P2 using line style STL. At this tangent is codirected with D1, D2 and proportional to its amplitude. Parameter NUM define the ``quality'' of the curve. If NUM=2 then the straight line will be drawn in all coordinate system (independently on transformation formulas, see Curved coordinates). Contrary, for large values (for example, =100) the spline like Bezier curve will be drawn in corresponding coordinate system. Curve will be drawn even if it lies out of bounding box.

 -- MGL command: face x1 y1 x2 y2 x3 y3 x4 y4 ['stl'='']
 -- MGL command: face x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 ['stl'='']
 -- Method on mglGraph: void Face (mglPoint p1, mglPoint p2, mglPoint p3, mglPoint p4, const char *stl="w")
 -- C function: void mgl_face (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal x3, mreal y3, mreal z3, mreal x4, mreal y4, mreal z4, const char *stl)
     Draws the solid quadrangle (face) with vertexes P1, P2, P3, P4 and with color(s) STL. At this colors can be the same for all vertexes or different if all 4 colors are specified for each vertex. Face will be drawn even if it lies out of bounding box. Argument STL can also contain mask specification (see Color scheme).

 -- MGL command: rect x1 y1 x2 y2 ['stl'='']
 -- MGL command: rect x1 y1 z1 x2 y2 z2 ['stl'='']
     Draws the solid rectangle (face) with vertexes {X1, Y1, Z1} and {X2, Y2, Z2} with color STL. At this colors can be the same for all vertexes or separately if all 4 colors are specified for each vertex. Face will be drawn even if it lies out of bounding box. Argument STL can also contain mask specification (see Color scheme).

 -- MGL command: facex x0 y0 z0 wy wz ['stl'='' d1=0 d2=0]
 -- MGL command: facey x0 y0 z0 wx wz ['stl'='' d1=0 d2=0]
 -- MGL command: facez x0 y0 z0 wx wy ['stl'='' d1=0 d2=0]
 -- Method on mglGraph: void FaceX (mreal x0, mreal y0, mreal z0, mreal wy, mreal wz, const char *stl="w", mreal d1=0, mreal d2=0)
 -- Method on mglGraph: void FaceY (mreal x0, mreal y0, mreal z0, mreal wx, mreal wz, const char *stl="w", mreal d1=0, mreal d2=0)
 -- Method on mglGraph: void FaceZ (mreal x0, mreal y0, mreal z0, mreal wx, mreal wy, const char *stl="w", mreal d1=0, mreal d2=0)
 -- C function: void mgl_facex (HMGL gr, mreal x0, mreal y0, mreal z0, mreal wy, mreal wz, const char *stl, mreal d1, mreal d2)
 -- C function: void mgl_facey (HMGL gr, mreal x0, mreal y0, mreal z0, mreal wx, mreal wz, const char *stl, mreal d1, mreal d2)
 -- C function: void mgl_facez (HMGL gr, mreal x0, mreal y0, mreal z0, mreal wx, mreal wy, const char *stl, mreal d1, mreal d2)
     Draws the solid rectangle (face) perpendicular to [x,y,z]-axis correspondingly at position {X0, Y0, Z0} with color STL and with widths WX, WY, WZ along corresponding directions. At this colors can be the same for all vertexes or separately if all 4 colors are specified for each vertex. Argument STL can also contain mask specification (see Color scheme). Parameters D1!=0, D2!=0 set additional shift of the last vertex (i.e. to draw quadrangle). Face will be drawn even if it lies out of bounding box.

 -- MGL command: sphere x0 y0 r ['col'='r']
 -- MGL command: sphere x0 y0 z0 r ['col'='r']
 -- Method on mglGraph: void Sphere (mglPoint p, mreal r, const char *stl="r")
 -- C function: void mgl_sphere (HMGL gr, mreal x0, mreal y0, mreal z0, mreal r, const char *stl)
     Draw the sphere with radius R and center at point P={X0, Y0, Z0} and color STL.

 -- MGL command: drop x0 y0 dx dy r ['col'='r' sh=1 asp=1]
 -- MGL command: drop x0 y0 z0 dx dy dz r ['col'='r' sh=1 asp=1]
 -- Method on mglGraph: void Drop (mglPoint p, mglPoint d, mreal r, const char *col="r", mreal shift=1, mreal ap=1)
 -- C function: void mgl_drop (HMGL gr, mreal x0, mreal y0, mreal z0, mreal dx, mreal dy, mreal dz, mreal r, const char *col, mreal shift, mreal ap)
     Draw the drop with radius R at point P elongated in direction D and with color COL. Parameter SHIFT set the degree of drop oblongness: 0 is sphere, 1 is maximally oblongness drop. Parameter AP set relative width of the drop (this is analogue of ``ellipticity'' for the sphere).

 -- MGL command: cone x1 y1 z1 x2 y2 z2 r1 [r2=-1 'stl'='']
 -- Method on mglGraph: void Cone (mglPoint p1, mglPoint p2, mreal r1, mreal r2=-1, const char *stl="B")
 -- C function: void mgl_cone (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal r1, mreal r2, const char *stl)
     Draw tube (or truncated cone if EDGE=false) between points P1, P2 with radius at the edges R1, R2. If R2<0 then it is supposed that R2=R1. The cone color is defined by string STL. Parameter STL can contain:

       * @ for drawing edges;

       * # for wired cones;

       * t for drawing tubes/cylinder instead of cones/prisms;

       * 4, 6, 8 for drawing square, hex- or octo-prism instead of cones.

 -- MGL command: circle x0 y0 r ['col'='r']
 -- MGL command: circle x0 y0 z0 r ['col'='r']
 -- Method on mglGraph: void Circle (mglPoint p, mreal r, const char *stl="r")
     Draw the circle with radius R and center at point P={X0, Y0, Z0}. Parameter COL may contain

       * colors for filling and boundary (second one if style @ is used, black color is used by default);

       * # for wire figure (boundary only);

       * @ for filling and boundary;

       * mask specification (see Color scheme).

 -- MGL command: ellipse x1 y1 x2 y2 r ['col'='r']
 -- MGL command: ellipse x1 y1 z1 x2 y2 z2 r ['col'='r']
 -- Method on mglGraph: void Ellipse (mglPoint p1, mglPoint p2, mreal r, const char *col="r")
 -- C function: void mgl_ellipse (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal r, const char *col)
     Draw the ellipse with radius R and focal points P1, P2. Parameter COL may contain

       * colors for filling and boundary (second one if style @ is used, black color is used by default);

       * # for wire figure (boundary only);

       * @ for filling and boundary;

       * mask specification (see Color scheme).

 -- MGL command: rhomb x1 y1 x2 y2 r ['col'='r']
 -- MGL command: rhomb x1 y1 z1 x2 y2 z2 r ['col'='r']
 -- Method on mglGraph: void Rhomb (mglPoint p1, mglPoint p2, mreal r, const char *col="r")
 -- C function: void mgl_rhomb (HMGL gr, mreal x1, mreal y1, mreal z1, mreal x2, mreal y2, mreal z2, mreal r, const char *col)
     Draw the rhombus with width R and edge points P1, P2. Parameter COL may contain

       * colors for filling and boundary (second one if style @ is used, black color is used by default);

       * # for wire figure (boundary only);

       * @ for filling and boundary;

       * mask specification (see Color scheme).

 -- MGL command: arc x0 y0 x1 y1 a ['col'='r']
 -- MGL command: arc x0 y0 z0 x1 y1 a ['col'='r']
 -- MGL command: arc x0 y0 z0 xa ya za x1 y1 z1 a ['col'='r']
 -- Method on mglGraph: void Arc (mglPoint p0, mglPoint p1, mreal a, const char *col="r")
 -- Method on mglGraph: void Arc (mglPoint p0, mglPoint pa, mglPoint p1, mreal a, const char *col="r")
 -- C function: void mgl_arc (HMGL gr, mreal x0, mreal y0, mreal x1, mreal y1, mreal a, const char *col)
 -- C function: void mgl_arc_ext (HMGL gr, mreal x0, mreal y0, mreal z0, mreal xa, mreal ya, mreal za, mreal x1, mreal y1, mreal z1, mreal a, const char *col)
     Draw the arc around axis PA (default is z-axis PA={0,0,1}) with center at P0 and starting from point P1. Parameter A set the angle of arc in degree. Parameter COL may contain color of the arc and arrow style for arc edges.

 -- MGL command: polygon x0 y0 x1 y1 num ['col'='r']
 -- MGL command: polygon x0 y0 z0 x1 y1 z1 num ['col'='r']
 -- Method on mglGraph: void Polygon (mglPoint p0, mglPoint p1, int num, const char *col="r")
 -- C function: void mgl_polygon (HMGL gr, mreal x0, mreal y0, mreal z0, mreal x1, mreal y1, mreal z1, int num, const char *col)
     Draw the polygon with NUM edges starting from P1. The center of polygon is located in P0. Parameter COL may contain

       * colors for filling and boundary (second one if style @ is used, black color is used by default);

       * # for wire figure (boundary only);

       * @ for filling and boundary;

       * mask specification (see Color scheme).

 -- MGL command: logo 'fname' [smooth=off]
 -- Method on mglGraph: void Logo (const char *fname, bool smooth=false, const char *opt="")
 -- Method on mglGraph: void Logo (long w, long h, const unsigned char *rgba, bool smooth=false, const char *opt="")
 -- C function only: void mgl_logo (HMGL gr, long w, long h, const unsigned char *rgba, bool smooth, const char *opt)
 -- C function: void mgl_logo_file (HMGL gr, const char *fname, bool smooth, const char *opt)
     Draw bitmap (logo) along whole axis range, which can be changed by Command options. Bitmap can be loaded from file or specified as RGBA values for pixels. Parameter SMOOTH set to draw bitmap without or with color interpolation.

 -- MGL command: symbol x y 'id' ['fnt'='' size=-1]
 -- MGL command: symbol x y z 'id' ['fnt'='' size=-1]
 -- Method on mglGraph: void Symbol (mglPoint p, char id, const char *fnt="", mreal size=-1)
 -- C function: void mgl_symbol (HMGL gr, mreal x, mreal y, mreal z, char id, const char *fnt, mreal size)
     Draws user-defined symbol with name ID at position P with style specifying by FNT. The size of font is set by SIZE parameter (default is -1). The string FNT may contain color specification ended by : symbol; styles a, A to draw at absolute position {X, Y} (supposed to be in range [0,1]) of picture (for A) or subplot/inplot (for a); and style w to draw wired symbol.

 -- MGL command: symbol x y dx dy 'id' ['fnt'=':L' size=-1]
 -- MGL command: symbol x y z dx dy dz 'id' ['fnt'=':L' size=-1]
 -- Method on mglGraph: void Symbol (mglPoint p, mglPoint d, char id, const char *fnt="", mreal size=-1)
 -- C function: void mgl_symbol_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const char *text, const char *fnt, mreal size)
     The same as previous but symbol will be drawn rotated along direction D.

 -- MGL command: addsymbol 'id' xdat ydat
 -- Method on mglGraph: void DefineSymbol (char id, const mglDataA &xdat, const mglDataA &ydat)
 -- C function: void mgl_define_symbol (HMGL gr, HCDT xdat, HCDT ydat)
     Add user-defined symbol with name ID and contour {XDAT, YDAT}. You can use NAN values to set break (jump) of contour curve.

external

Text printing
=============

nav

These functions draw the text. There are functions for drawing text in arbitrary place, in arbitrary direction and along arbitrary curve. MathGL can use arbitrary font-faces and parse many TeX commands (for more details see Font styles). All these functions have 2 variant: for printing 8-bit text (char *) and for printing Unicode text (wchar_t *). In first case the conversion into the current locale is used. So sometimes you need to specify it by setlocale() function. The SIZE argument control the size of text: if positive it give the value, if negative it give the value relative to SetFontSize(). The font type (STIX, arial, courier, times and so on) can be selected by function LoadFont(). See Font settings.

The font parameters are described by string. This string may set the text color wkrgbcymhRGBCYMHW (see Color styles). Starting from MathGL v.2.3, you can set color gradient for text (see Color scheme). Also,  after delimiter symbol :, it can contain characters of font type (rbiwou) and/or align (LRCTV) specification. The font types are: r -- roman (or regular) font, i -- italic style, b -- bold style, w -- wired style, o -- over-lined text, u -- underlined text. By default roman font is used. The align types are: L -- align left (default), C -- align center, R -- align right, T -- align under, V -- align center vertical. For example, string b:iC correspond to italic font style for centered text which printed by blue color.

If string contains symbols aA then text is printed at absolute position {X, Y} (supposed to be in range [0,1]) of picture (for A) or subplot/inplot (for a). If string contains symbol @ then box around text is drawn.

Text features

 -- MGL command: text x y 'text' ['fnt'='' size=-1]
 -- MGL command: text x y z 'text' ['fnt'='' size=-1]
 -- Method on mglGraph: void Puts (mglPoint p, const char *text, const char *fnt=":C", mreal size=-1)
 -- Method on mglGraph: void Putsw (mglPoint p, const wchar_t *text, const char *fnt=":C", mreal size=-1)
 -- Method on mglGraph: void Puts (mreal x, mreal y, const char *text, const char *fnt=":AC", mreal size=-1)
 -- Method on mglGraph: void Putsw (mreal x, mreal y, const wchar_t *text, const char *fnt=":AC", mreal size=-1)
 -- C function: void mgl_puts (HMGL gr, mreal x, mreal y, mreal z, const char *text, const char *fnt, mreal size)
 -- C function: void mgl_putsw (HMGL gr, mreal x, mreal y, mreal z, const wchar_t *text, const char *fnt, mreal size)
     Draws the string TEXT at position P with fonts specifying by the criteria FNT. The size of font is set by SIZE parameter (default is -1).

 -- MGL command: text x y dx dy 'text' ['fnt'=':L' size=-1]
 -- MGL command: text x y z dx dy dz 'text' ['fnt'=':L' size=-1]
 -- Method on mglGraph: void Puts (mglPoint p, mglPoint d, const char *text, const char *fnt=":L", mreal size=-1)
 -- Method on mglGraph: void Putsw (mglPoint p, mglPoint d, const wchar_t *text, const char *fnt=":L", mreal size=-1)
 -- C function: void mgl_puts_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const char *text, const char *fnt, mreal size)
 -- C function: void mgl_putsw_dir (HMGL gr, mreal x, mreal y, mreal z, mreal dx, mreal dy, mreal dz, const wchar_t *text, const char *fnt, mreal size)
     Draws the string TEXT at position P along direction D with specified SIZE. Parameter FNT set text style and text position: under (T) or above (t) the line.

 -- MGL command: fgets x y 'fname' [n=0 'fnt'='' size=-1.4]
 -- MGL command: fgets x y z 'fname' [n=0 'fnt'='' size=-1.4]
     Draws unrotated N-th line of file FNAME at position {X,Y,Z} with specified SIZE. By default parameters from font command are used.

 -- MGL command: text ydat 'text' ['fnt'='']
 -- MGL command: text xdat ydat 'text' ['fnt'='']
 -- MGL command: text xdat ydat zdat 'text' ['fnt'='']
 -- Method on mglGraph: void Text (const mglDataA &y, const char *text, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Text (const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const char *text, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const wchar_t *text, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *text, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Text (const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *text, const char *fnt="", const char *opt="")
 -- C function: void mgl_text_y (HMGL gr, HCDT y, const char *text, const char *fnt, const char *opt)
 -- C function: void mgl_textw_y (HMGL gr, HCDT y, const wchar_t *text, const char *fnt, const char *opt)
 -- C function: void mgl_text_xy (HCDT x, HCDT y, const char *text, const char *fnt, const char *opt)
 -- C function: void mgl_textw_xy (HCDT x, HCDT y, const wchar_t *text, const char *fnt, const char *opt)
 -- C function: void mgl_text_xyz (HCDT x, HCDT y, HCDT z, const char *text, const char *fnt, const char *opt)
 -- C function: void mgl_textw_xyz (HCDT x, HCDT y, HCDT z, const wchar_t *text, const char *fnt, const char *opt)
     The function draws TEXT along the curve between points {X[i], Y[i], Z[i]} by font style FNT. The string FNT may contain symbols t for printing the text under the curve (default), or T for printing the text under the curve. The sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx. If array X is not specified then its an automatic array is used with values equidistantly distributed in x-axis range (see Ranges (bounding box)). If array Z is not specified then Z[i] equal to minimal z-axis value is used. String OPT contain command options (see Command options).

external

Axis and Colorbar
=================

nav

These functions draw the ``things for measuring'', like axis with ticks, colorbar with ticks, grid along axis, bounding box and labels for axis. For more information see Axis settings.

 -- MGL command: axis ['dir'='xyz' 'stl'='']
 -- Method on mglGraph: void Axis (const char *dir="xyz", const char *stl="", const char *opt="")
 -- C function: void mgl_axis (HMGL gr, const char *dir, const char *stl, const char *opt)
     Draws axes with ticks (see Axis settings). Parameter DIR may contain:

       * xyz for drawing axis in corresponding direction;

       * XYZ for drawing axis in corresponding direction but with inverted positions of labels;

       * ~ or _ for disabling tick labels;

       * U for disabling rotation of tick labels;

       * ^ for inverting default axis origin;

       * ! for disabling ticks tuning (see tuneticks);

       * AKDTVISO for drawing arrow at the end of axis;

       * a for forced adjusting of axis ticks;

       * : for drawing lines through point (0,0,0);

       * f for printing ticks labels in fixed format;

       * E for using E instead of e in ticks labels;

       * F for printing ticks labels in LaTeX format;

       * + for printing + for positive ticks;

       * - for printing usual - in ticks labels;

       * 0123456789 for precision at printing ticks labels.

     Styles of ticks and axis can be overrided by using STL string. Option value set the manual rotation angle for the ticks. Axis and ticks

 -- MGL command: colorbar ['sch'='']
 -- Method on mglGraph: void Colorbar (const char *sch="")
 -- C function: void mgl_colorbar (HMGL gr, const char *sch)
     Draws colorbar. Parameter SCH may contain:

       * color scheme (see Color scheme);

       * <>^_ for positioning at left, at right, at top or at bottom correspondingly;

       * I for positioning near bounding (by default, is positioned at edges of subplot);

       * A for using absolute coordinates;

       * ~ for disabling tick labels.

       * ! for disabling ticks tuning (see tuneticks);

       * f for printing ticks labels in fixed format;

       * E for using E instead of e in ticks labels;

       * F for printing ticks labels in LaTeX format;

       * + for printing + for positive ticks;

       * - for printing usual - in ticks labels;

       * 0123456789 for precision at printing ticks labels.

     Colorbars

 -- MGL command: colorbar vdat ['sch'='']
 -- Method on mglGraph: void Colorbar (const mglDataA &v, const char *sch="")
 -- C function: void mgl_colorbar_val (HMGL gr, HCDT v, const char *sch)
     The same as previous but with sharp colors SCH (current palette if sch="") for values V. contd sample

 -- MGL command: colorbar 'sch' x y [w=1 h=1]
 -- Method on mglGraph: void Colorbar (const char *sch, mreal x, mreal y, mreal w=1, mreal h=1)
 -- C function: void mgl_colorbar_ext (HMGL gr, const char *sch, mreal x, mreal y, mreal w, mreal h)
     The same as first one but at arbitrary position of subplot {X, Y} (supposed to be in range [0,1]). Parameters W, H set the relative width and height of the colorbar.

 -- MGL command: colorbar vdat 'sch' x y [w=1 h=1]
 -- Method on mglGraph: void Colorbar (const mglDataA &v, const char *sch, mreal x, mreal y, mreal w=1, mreal h=1)
 -- C function: void mgl_colorbar_val_ext (HMGL gr, HCDT v, const char *sch, mreal x, mreal y, mreal w, mreal h)
     The same as previous but with sharp colors SCH (current palette if sch="") for values V. contd sample

 -- MGL command: grid ['dir'='xyz' 'pen'='B']
 -- Method on mglGraph: void Grid (const char *dir="xyz", const char *pen="B", const char *opt="")
 -- C function: void mgl_axis_grid (HMGL gr, const char *dir, const char *pen, const char *opt)
     Draws grid lines perpendicular to direction determined by string parameter DIR. If DIR contain ! then grid lines will be drawn at coordinates of subticks also. The step of grid lines is the same as tick step for axis. The style of lines is determined by PEN parameter (default value is dark blue solid line B-).

 -- MGL command: box ['stl'='k' ticks=on]
 -- Method on mglGraph: void Box (const char *col="", bool ticks=true)
 -- C function: void mgl_box (HMGL gr)
 -- C function: void mgl_box_str (HMGL gr, const char *col, int ticks)
     Draws bounding box outside the plotting volume with color COL. If COL contain @ then filled faces are drawn. At this first color is used for faces (default is light yellow), last one for edges. Bounding box

 -- MGL command: xlabel 'text' [pos=1]
 -- MGL command: ylabel 'text' [pos=1]
 -- MGL command: zlabel 'text' [pos=1]
 -- MGL command: tlabel 'text' [pos=1]
 -- MGL command: clabel 'text' [pos=1]
 -- Method on mglGraph: void Label (char dir, const char *text, mreal pos=1, const char *opt="")
 -- Method on mglGraph: void Label (char dir, const wchar_t *text, mreal pos=1, const char *opt="")
 -- C function: void mgl_label (HMGL gr, char dir, const char *text, mreal pos, const char *opt)
 -- C function: void mgl_labelw (HMGL gr, char dir, const wchar_t *text, mreal pos, const char *opt)
     Prints the label TEXT for axis DIR=x,y,z,t,c, where t is ``ternary'' axis t=1-x-y; c is color axis (should be called after colorbar). The position of label is determined by POS parameter. If POS=0 then label is printed at the center of axis. If POS>0 then label is printed at the maximum of axis. If POS<0 then label is printed at the minimum of axis. Option value set additional shifting of the label. See Text printing.

external

Legend
======

nav

These functions draw legend to the graph (useful for 1D plotting). Legend entry is a pair of strings: one for style of the line, another one with description text (with included TeX parsing). The arrays of strings may be used directly or by accumulating first to the internal arrays (by function addlegend) and further plotting it. The position of the legend can be selected automatic or manually (even out of bounding box). Parameters FNT and SIZE specify the font style and size (see Font settings). Option value set the relative width of the line sample and the text indent. If line style string for entry is empty then the corresponding text is printed without indent. Parameter FNT may contain:

  * font style for legend text;

  * A for positioning in absolute coordinates;

  * ^ for positioning outside of specified point;

  * # for drawing box around legend;

  * - for arranging legend entries horizontally;

  * colors for face (1st one), for border (2nd one) and for text (last one). If less than 3 colors are specified then the color for border is black (for 2 and less colors), and the color for face is white (for 1 or none colors).

Legend sample

 -- MGL command: legend [pos=3 'fnt'='#']
 -- Method on mglGraph: void Legend (int pos=0x3, const char *fnt="#", const char *opt="")
 -- C function: void mgl_legend (HMGL gr, int pos, const char *fnt, const char *opt)
     Draws legend of accumulated legend entries by font FNT with SIZE. Parameter POS sets the position of the legend: 0 is bottom left corner, 1 is bottom right corner, 2 is top left corner, 3 is top right corner (is default). Option value set the space between line samples and text (default is 0.1).

 -- MGL command: legend x y ['fnt'='#']
 -- Method on mglGraph: void Legend (mreal x, mreal y, const char *fnt="#", const char *opt="")
 -- C function: void mgl_legend_pos (HMGL gr, mreal x, mreal y, const char *fnt, const char *opt)
     Draws legend of accumulated legend entries by font FNT with SIZE. Position of legend is determined by parameter X, Y which supposed to be normalized to interval [0,1]. Option value set the space between line samples and text (default is 0.1).

 -- MGL command: addlegend 'text' 'stl'
 -- Method on mglGraph: void AddLegend (const char *text, const char *style)
 -- Method on mglGraph: void AddLegend (const wchar_t *text, const char *style)
 -- C function: void mgl_add_legend (HMGL gr, const char *text, const char *style)
 -- C function: void mgl_add_legendw (HMGL gr, const wchar_t *text, const char *style)
     Adds string TEXT to internal legend accumulator. The style of described line and mark is specified in string STYLE (see Line styles).

 -- MGL command: clearlegend
 -- Method on mglGraph: void ClearLegend ()
 -- C function: void mgl_clear_legend (HMGL gr)
     Clears saved legend strings.

 -- MGL command: legendmarks val
 -- Method on mglGraph: void SetLegendMarks (int num)
 -- C function: void mgl_set_legend_marks (HMGL gr, int num)
     Set the number of marks in the legend. By default 1 mark is used.

external

1D plotting
===========

nav

These functions perform plotting of 1D data. 1D means that data depended from only 1 parameter like parametric curve {x[i],y[i],z[i]}, i=1...n. By default (if absent) values of X[i] are equidistantly distributed in axis range, and Z[i] equal to minimal z-axis value. The plots are drawn for each row if one of the data is the matrix. By any case the sizes of 1st dimension must be equal for all arrays x.nx=y.nx=z.nx.

String PEN specifies the color and style of line and marks (see Line styles). By default (pen="") solid line with color from palette is used (see Palette and colors). Symbol ! set to use new color from palette for each point (not for each curve, as default). String OPT contain command options (see Command options).

 -- MGL command: plot ydat ['stl'='']
 -- MGL command: plot xdat ydat ['stl'='']
 -- MGL command: plot xdat ydat zdat ['stl'='']
 -- Method on mglGraph: void Plot (const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Plot (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Plot (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
 -- C function: void mgl_plot (HMGL gr, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_plot_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_plot_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
     These functions draw continuous lines between points {X[i], Y[i], Z[i]}. If PEN contain a then segments between points outside of axis range are drawn too. If PEN contain ~ then number of segments is reduce for quasi-straight curves. See also area, step, stem, tube, mark, error, belt, tens, tape, meshnum. plot sample

 -- MGL command: radar adat ['stl'='']
 -- Method on mglGraph: void Radar (const mglDataA &a, const char *pen="", const char *opt="")
 -- C function: void mgl_radar (HMGL gr, HCDT a, const char *pen, const char *opt)
     This functions draws radar chart which is continuous lines between points located on an radial lines (like plot in Polar coordinates). Option value set the additional shift of data (i.e. the data A+value is used instead of A). If value<0 then r=max(0, -min(value). If PEN containt # symbol then "grid" (radial lines and circle for R) is drawn. If PEN contain a then segments between points outside of axis range are drawn too. See also plot, meshnum. radar sample

 -- MGL command: step ydat ['stl'='']
 -- MGL command: step xdat ydat ['stl'='']
 -- MGL command: step xdat ydat zdat ['stl'='']
 -- Method on mglGraph: void Step (const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Step (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Step (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
 -- C function: void mgl_step (HMGL gr, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_step_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_step_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
     These functions draw continuous stairs for points to axis plane. If X.nx>Y.nx then X set the edges of bars, rather than its central positions. See also plot, stem, tile, boxs, meshnum. step sample

 -- MGL command: tens ydat cdat ['stl'='']
 -- MGL command: tens xdat ydat cdat ['stl'='']
 -- MGL command: tens xdat ydat zdat cdat ['stl'='']
 -- Method on mglGraph: void Tens (const mglDataA &y, const mglDataA &c, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Tens (const mglDataA &x, const mglDataA &y, const mglDataA &c, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Tens (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *pen="", const char *opt="")
 -- C function: void mgl_tens (HMGL gr, HCDT y, HCDT c, const char *pen, const char *opt)
 -- C function: void mgl_tens_xy (HMGL gr, HCDT x, HCDT y, HCDT c, const char *pen, const char *opt)
 -- C function: void mgl_tens_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *pen, const char *opt)
     These functions draw continuous lines between points {X[i], Y[i], Z[i]} with color defined by the special array C[i] (look like tension plot). String PEN specifies the color scheme (see Color scheme) and style and/or width of line (see Line styles). If PEN contain a then segments between points outside of axis range are drawn too. If PEN contain ~ then number of segments is reduce for quasi-straight curves. See also plot, mesh, fall, meshnum. tens sample

 -- MGL command: tape ydat ['stl'='']
 -- MGL command: tape xdat ydat ['stl'='']
 -- MGL command: tape xdat ydat zdat ['stl'='']
 -- Method on mglGraph: void Tape (const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Tape (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Tape (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
 -- C function: void mgl_tape (HMGL gr, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_tape_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_tape_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
     These functions draw tapes of normals for curve between points {X[i], Y[i], Z[i]}. Initial tape(s) was selected in x-y plane (for x in PEN) and/or y-z plane (for x in PEN). Argument PEN can also contain mask specification (see Color scheme). The width of tape is proportional to barwidth and can be changed by option value. See also plot, flow, barwidth. tape sample

 -- MGL command: area ydat ['stl'='']
 -- MGL command: area xdat ydat ['stl'='']
 -- MGL command: area xdat ydat zdat ['stl'='']
 -- Method on mglGraph: void Area (const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Area (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Area (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
 -- C function: void mgl_area (HMGL gr, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_area_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_area_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
     These functions draw continuous lines between points and fills it to axis plane. Also you can use gradient filling if number of specified colors is equal to 2*number of curves. If PEN contain # then wired plot is drawn. If PEN contain a then segments between points outside of axis range are drawn too. Argument PEN can also contain mask specification (see Color scheme). See also plot, bars, stem, region. area sample

 -- MGL command: region ydat1 ydat2 ['stl'='']
 -- MGL command: region xdat ydat1 ydat2 ['stl'='']
 -- MGL command: region xdat1 ydat1 xdat2 ydat2 ['stl'='']
 -- MGL command: region xdat1 ydat1 zdat1 xdat2 ydat2 zdat2 ['stl'='']
 -- Method on mglGraph: void Region (const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Region (const mglDataA &x, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Region (const mglDataA &x1, const mglDataA &y1, const mglDataA &x2, const mglDataA &y2, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Region (const mglDataA &x1, const mglDataA &y1, const mglDataA &z1, const mglDataA &x2, const mglDataA &y2, const mglDataA &z2, const char *pen="", const char *opt="")
 -- C function: void mgl_region (HMGL gr, HCDT y1, HCDT y2, const char *pen, const char *opt)
 -- C function: void mgl_region_xy (HMGL gr, HCDT x, HCDT y1, HCDT y2, const char *pen, const char *opt)
 -- C function: void mgl_region_3d (HMGL gr, HCDT x1, HCDT y1, HCDT z1, HCDT x2, HCDT y2, HCDT z2, const char *pen, const char *opt)
     These functions fill area between 2 curves. Dimensions of arrays Y1 and Y2 must be equal. Also you can use gradient filling if number of specified colors is equal to 2*number of curves. If for 2D version PEN contain symbol i then only area with y1<y<y2 will be filled else the area with y2<y<y1 will be filled too. If PEN contain # then wired plot is drawn. If PEN contain a then segments between points outside of axis range are drawn too. Argument PEN can also contain mask specification (see Color scheme). See also area, bars, stem. region sample

 -- MGL command: stem ydat ['stl'='']
 -- MGL command: stem xdat ydat ['stl'='']
 -- MGL command: stem xdat ydat zdat ['stl'='']
 -- Method on mglGraph: void Stem (const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Stem (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Stem (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
 -- C function: void mgl_stem (HMGL gr, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_stem_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_stem_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
     These functions draw vertical lines from points to axis plane. See also area, bars, plot, mark. stem sample

 -- MGL command: bars ydat ['stl'='']
 -- MGL command: bars xdat ydat ['stl'='']
 -- MGL command: bars xdat ydat zdat ['stl'='']
 -- Method on mglGraph: void Bars (const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Bars (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Bars (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
 -- C function: void mgl_bars (HMGL gr, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_bars_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_bars_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
     These functions draw vertical bars from points to axis plane. Parameter PEN can contain:

       * a for drawing lines one above another (like summation);

       * f for drawing waterfall chart, which show the cumulative effect of sequential positive or negative values;

       * F for using fixed (minimal) width for all bars;

       * <, ^ or > for aligning boxes left, right or centering them at its x-coordinates;

       * mask specification (see Color scheme).

     You can give different colors for positive and negative values if number of specified colors is equal to 2*number of curves. If X.nx>Y.nx then X set the edges of bars, rather than its central positions. See also barh, cones, area, stem, chart, barwidth. bars sample

 -- MGL command: barh vdat ['stl'='']
 -- MGL command: barh ydat vdat ['stl'='']
 -- Method on mglGraph: void Barh (const mglDataA &v, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Barh (const mglDataA &y, const mglDataA &v, const char *pen="", const char *opt="")
 -- C function: void mgl_barh (HMGL gr, HCDT v, const char *pen, const char *opt)
 -- C function: void mgl_barh_xy (HMGL gr, HCDT y, HCDT v, const char *pen, const char *opt)
     These functions draw horizontal bars from points to axis plane. Parameter PEN can contain:

       * a for drawing lines one above another (like summation);

       * f for drawing waterfall chart, which show the cumulative effect of sequential positive or negative values;

       * F for using fixed (minimal) width for all bars;

       * <, ^ or > for aligning boxes left, right or centering them at its x-coordinates;

       * mask specification (see Color scheme).

     You can give different colors for positive and negative values if number of specified colors is equal to 2*number of curves. If X.nx>Y.nx then X set the edges of bars, rather than its central positions. See also bars, barwidth. barh sample

 -- MGL command: cones ydat ['stl'='']
 -- MGL command: cones xdat ydat ['stl'='']
 -- MGL command: cones xdat ydat zdat ['stl'='']
 -- Method on mglGraph: void Cones (const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Cones (const mglDataA &x, const mglDataA &y, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Cones (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *pen="", const char *opt="")
 -- C function: void mgl_cones (HMGL gr, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_cones_xy (HMGL gr, HCDT x, HCDT y, const char *pen, const char *opt)
 -- C function: void mgl_cones_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *pen, const char *opt)
     These functions draw cones from points to axis plane. If string contain symbol a then cones are drawn one above another (like summation). You can give different colors for positive and negative values if number of specified colors is equal to 2*number of curves. Parameter PEN can contain:

       * @ for drawing edges;

       * # for wired cones;

       * t for drawing tubes/cylinders instead of cones/prisms;

       * 4, 6, 8 for drawing square, hex- or octo-prism instead of cones;

       * <, ^ or > for aligning boxes left, right or centering them at its x-coordinates.

     See also bars, cone, barwidth. cones sample

 -- MGL command: chart adat ['col'='']
 -- Method on mglGraph: void Chart (const mglDataA &a, const char *col="", const char *opt="")
 -- C function: void mgl_chart (HMGL gr, HCDT a, const char *col, const char *opt)
     The function draws colored stripes (boxes) for data in array A. The number of stripes is equal to the number of rows in A (equal to A.NY). The color of each next stripe is cyclically changed from colors specified in string COL or in palette Pal (see Palette and colors).  Argument COL can also contain mask specification (see Color scheme). Spaces in colors denote transparent ``color'' (i.e. corresponding stripe(s) are not drawn). The stripe width is proportional to value of element in A. Chart is plotted only for data with non-negative elements. If string COL have symbol # then black border lines are drawn. The most nice form the chart have in 3d (after rotation of coordinates) or in cylindrical coordinates (becomes so called Pie chart). chart sample

 -- MGL command: boxplot adat ['stl'='']
 -- MGL command: boxplot xdat adat ['stl'='']
 -- Method on mglGraph: void BoxPlot (const mglDataA &a, const char *pen="", const char *opt="")
 -- Method on mglGraph: void BoxPlot (const mglDataA &x, const mglDataA &a, const char *pen="", const char *opt="")
 -- C function: void mgl_boxplot (HMGL gr, HCDT a, const char *pen, const char *opt)
 -- C function: void mgl_boxplot_xy (HMGL gr, HCDT x, HCDT a, const char *pen, const char *opt)
     These functions draw boxplot (also known as a box-and-whisker diagram) at points X[i]. This is five-number summaries of data A[i,j] (minimum, lower quartile (Q1), median (Q2), upper quartile (Q3) and maximum) along second (j-th) direction. If PEN contain <, ^ or > then boxes will be aligned left, right or centered at its x-coordinates. See also plot, error, bars, barwidth. boxplot sample

 -- MGL command: candle vdat1 ['stl'='']
 -- MGL command: candle vdat1 vdat2 ['stl'='']
 -- MGL command: candle vdat1 ydat1 ydat2 ['stl'='']
 -- MGL command: candle vdat1 vdat2 ydat1 ydat2 ['stl'='']
 -- MGL command: candle xdat vdat1 vdat2 ydat1 ydat2 ['stl'='']
 -- Method on mglGraph: void Candle (const mglDataA &v1, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Candle (const mglDataA &v1, const mglDataA &v2, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Candle (const mglDataA &v1, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Candle (const mglDataA &v1, const mglDataA &v2, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Candle (const mglDataA &x, const mglDataA &v1, const mglDataA &v2, const mglDataA &y1, const mglDataA &y2, const char *pen="", const char *opt="")
 -- C function: void mgl_candle (HMGL gr, HCDT v1, HCDT y1, HCDT y2, const char *pen, const char *opt)
 -- C function: void mgl_candle_yv (HMGL gr, HCDT v1, HCDT v2, HCDT y1, HCDT y2, const char *pen, const char *opt)
 -- C function: void mgl_candle_xyv (HMGL gr, HCDT x, HCDT v1, HCDT v2, HCDT y1, HCDT y2, const char *pen, const char *opt)
     These functions draw candlestick chart at points X[i]. This is a combination of a line-chart and a bar-chart, in that each bar represents the range of price movement over a given time interval. Wire (or white) candle correspond to price growth V1[i]<V2[i], opposite case -- solid (or dark) candle. You can give different colors for growth and decrease values if number of specified colors is equal to 2. If PEN contain # then the wire candle will be used even for 2-color scheme. Argument PEN can also contain mask specification (see Color scheme). "Shadows" show the minimal Y1 and maximal Y2 prices. If V2 is absent then it is determined as V2[i]=V1[i+1]. See also plot, bars, ohlc, barwidth. candle sample

 -- MGL command: ohlc odat hdat ldat cdat ['stl'='']
 -- MGL command: ohlc xdat odat hdat ldat cdat ['stl'='']
 -- Method on mglGraph: void OHLC (const mglDataA &o, const mglDataA &h, const mglDataA &l, const mglDataA &c, const char *pen="", const char *opt="")
 -- Method on mglGraph: void OHLC (const mglDataA &x, const mglDataA &o, const mglDataA &h, const mglDataA &l, const mglDataA &c, const char *pen="", const char *opt="")
 -- C function: void mgl_ohlc (HMGL gr, HCDT o, HCDT h, HCDT l, HCDT c, const char *pen, const char *opt)
 -- C function: void mgl_ohlc_x (HMGL gr, HCDT x, HCDT o, HCDT h, HCDT l, HCDT c, const char *pen, const char *opt)
     These functions draw Open-High-Low-Close diagram. This diagram show vertical line for between maximal(high H) and minimal(low L) values, as well as horizontal lines before/after vertical line for initial(open O)/final(close C) values of some process (usually price). You can give different colors for up and down values (when closing values higher or not as in previous point) if number of specified colors is equal to 2*number of curves. See also candle, plot, barwidth. ohlc sample

 -- MGL command: error ydat yerr ['stl'='']
 -- MGL command: error xdat ydat yerr ['stl'='']
 -- MGL command: error xdat ydat xerr yerr ['stl'='']
 -- Method on mglGraph: void Error (const mglDataA &y, const mglDataA &ey, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Error (const mglDataA &x, const mglDataA &y, const mglDataA &ey, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Error (const mglDataA &x, const mglDataA &y, const mglDataA &ex, const mglDataA &ey, const char *pen="", const char *opt="")
 -- C function: void mgl_error (HMGL gr, HCDT y, HCDT ey, const char *pen, const char *opt)
 -- C function: void mgl_error_xy (HMGL gr, HCDT x, HCDT y, HCDT ey, const char *pen, const char *opt)
 -- C function: void mgl_error_exy (HMGL gr, HCDT x, HCDT y, HCDT ex, HCDT ey, const char *pen, const char *opt)
     These functions draw error boxes {EX[i], EY[i]} at points {X[i], Y[i]}. This can be useful, for example, in experimental points, or to show numeric error or some estimations and so on. If string PEN contain symbol @ than large semitransparent mark is used instead of error box. See also plot, mark. error sample

 -- MGL command: mark ydat rdat ['stl'='']
 -- MGL command: mark xdat ydat rdat ['stl'='']
 -- MGL command: mark xdat ydat zdat rdat ['stl'='']
 -- Method on mglGraph: void Mark (const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Mark (const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Mark (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *pen="", const char *opt="")
 -- C function: void mgl_mark_y (HMGL gr, HCDT y, HCDT r, const char *pen, const char *opt)
 -- C function: void mgl_mark_xy (HMGL gr, HCDT x, HCDT y, HCDT r, const char *pen, const char *opt)
 -- C function: void mgl_mark_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *pen, const char *opt)
     These functions draw marks with size R[i]*marksize at points {X[i], Y[i], Z[i]}. If you need to draw markers of the same size then you can use plot function with empty line style  . For markers with size in axis range use error with style @. See also plot, textmark, error, stem, meshnum. mark sample

 -- MGL command: textmark ydat 'txt' ['stl'='']
 -- MGL command: textmark ydat rdat 'txt' ['stl'='']
 -- MGL command: textmark xdat ydat rdat 'txt' ['stl'='']
 -- MGL command: textmark xdat ydat zdat rdat 'txt' ['stl'='']
 -- Method on mglGraph: void TextMark (const mglDataA &y, const char *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void TextMark (const mglDataA &y, const wchar_t *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void TextMark (const mglDataA &y, const mglDataA &r, const char *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void TextMark (const mglDataA &y, const mglDataA &r, const wchar_t *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &r, const wchar_t *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void TextMark (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const wchar_t *txt, const char *fnt="", const char *opt="")
 -- C function: void mgl_textmark (HMGL gr, HCDT y, const char *txt, const char *fnt, const char *opt)
 -- C function: void mgl_textmarkw (HMGL gr, HCDT y, const wchar_t *txt, const char *fnt, const char *opt)
 -- C function: void mgl_textmark_yr (HMGL gr, HCDT y, HCDT r, const char *txt, const char *fnt, const char *opt)
 -- C function: void mgl_textmarkw_yr (HMGL gr, HCDT y, HCDT r, const wchar_t *txt, const char *fnt, const char *opt)
 -- C function: void mgl_textmark_xyr (HMGL gr, HCDT x, HCDT y, HCDT r, const char *txt, const char *fnt, const char *opt)
 -- C function: void mgl_textmarkw_xyr (HMGL gr, HCDT x, HCDT y, HCDT r, const wchar_t *txt, const char *fnt, const char *opt)
 -- C function: void mgl_textmark_xyzr (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *txt, const char *fnt, const char *opt)
 -- C function: void mgl_textmarkw_xyzr (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const wchar_t *txt, const char *fnt, const char *opt)
     These functions draw string TXT as marks with size proportional to R[i]*MARKSIZE at points {X[i], Y[i], Z[i]}. By default (if omitted) R[i]=1. See also plot, mark, stem, meshnum. textmark sample

 -- MGL command: label ydat 'txt' ['stl'='']
 -- MGL command: label xdat ydat 'txt' ['stl'='']
 -- MGL command: label xdat ydat zdat 'txt' ['stl'='']
 -- Method on mglGraph: void Label (const mglDataA &y, const char *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Label (const mglDataA &y, const wchar_t *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Label (const mglDataA &x, const mglDataA &y, const char *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Label (const mglDataA &x, const mglDataA &y, const wchar_t *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Label (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Label (const mglDataA &x, const mglDataA &y, const mglDataA &z, const wchar_t *txt, const char *fnt="", const char *opt="")
 -- C function: void mgl_label (HMGL gr, HCDT y, const char *txt, const char *fnt, const char *opt)
 -- C function: void mgl_labelw (HMGL gr, HCDT y, const wchar_t *txt, const char *fnt, const char *opt)
 -- C function: void mgl_label_xy (HMGL gr, HCDT x, HCDT y, const char *txt, const char *fnt, const char *opt)
 -- C function: void mgl_labelw_xy (HMGL gr, HCDT x, HCDT y, const wchar_t *txt, const char *fnt, const char *opt)
 -- C function: void mgl_label_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const char *txt, const char *fnt, const char *opt)
 -- C function: void mgl_labelw_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, const wchar_t *txt, const char *fnt, const char *opt)
     These functions draw string TXT at points {X[i], Y[i], Z[i]}. If string TXT contain %x, %y, %z or %n then it will be replaced by the value of x-,y-,z-coordinate of the point or its index. String FNT may contain:

       * font style Font styles;

       * f for fixed format of printed numbers;

       * E for using E instead of e;

       * F for printing in LaTeX format;

       * + for printing + for positive numbers;

       * - for printing usual -;

       * 0123456789 for precision at printing numbers.

     See also plot, mark, textmark, table. label sample

 -- MGL command: table vdat 'txt' ['stl'='#']
 -- MGL command: table x y vdat 'txt' ['stl'='#']
 -- Method on mglGraph: void Table (const mglDataA &val, const char *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Table (const mglDataA &val, const wchar_t *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Table (mreal x, mreal y, const mglDataA &val, const char *txt, const char *fnt="", const char *opt="")
 -- Method on mglGraph: void Table (mreal x, mreal y, const mglDataA &val, const wchar_t *txt, const char *fnt="", const char *opt="")
 -- C function: void mgl_table (HMGL gr, mreal x, mreal y, HCDT val, const char *txt, const char *fnt, const char *opt)
 -- C function: void mgl_tablew (HMGL gr, mreal x, mreal y, HCDT val, const wchar_t *txt, const char *fnt, const char *opt)
     These functions draw table with values of VAL and captions from string TXT (separated by newline symbol \n) at points {X, Y} (default at {0,0}) related to current subplot. String FNT may contain:

       * font style Font styles;

       * # for drawing cell borders;

       * | for limiting table widh by subplot one (equal to option value 1);

       * = for equal width of all cells;

       * f for fixed format of printed numbers;

       * E for using E instead of e;

       * F for printing in LaTeX format;

       * + for printing + for positive numbers;

       * - for printing usual -;

       * 0123456789 for precision at printing numbers.

     Option value set the width of the table (default is 1). See also plot, label. table sample

 -- MGL command: iris dats 'ids' ['stl'='']
 -- MGL command: iris dats rngs 'ids' ['stl'='']
 -- Method on mglGraph: void Iris (const mglDataA &dats, const char *ids, const char *stl="", const char *opt="")
 -- Method on mglGraph: void Iris (const mglDataA &dats, const wchar_t *ids, const char *stl="", const char *opt="")
 -- Method on mglGraph: void Iris (const mglDataA &dats, const mglDataA &rngs, const char *ids, const char *stl="", const char *opt="")
 -- Method on mglGraph: void Iris (const mglDataA &dats, const mglDataA &rngs, const wchar_t *ids, const char *stl="", const char *opt="")
 -- C function: void mgl_iris_1 (HMGL gr, HCDT dats, const char *ids, const char *stl, const char *opt)
 -- C function: void mgl_irisw_1 (HMGL gr, HCDT dats, const wchar_t *ids, const char *stl, const char *opt)
 -- C function: void mgl_iris (HMGL gr, HCDT dats, HCDT rngs, const char *ids, const char *stl, const char *opt)
 -- C function: void mgl_irisw (HMGL gr, HCDT dats, HCDT rngs, const wchar_t *ids, const char *stl, const char *opt)
     Draws Iris plots for determining cross-dependences of data arrays DATS (see http://en.wikipedia.org/wiki/Iris_flower_data_set). Data RNGS of size 2*DATS.nx provide manual axis ranges for each column. String IDS contain column names, separated by ; symbol. Option value set the text size for column names. You can add another data set to existing Iris plot by providing the same ranges RNGS and empty column names IDS. See also plot. iris sample

 -- MGL command: tube ydat rdat ['stl'='']
 -- MGL command: tube ydat rval ['stl'='']
 -- MGL command: tube xdat ydat rdat ['stl'='']
 -- MGL command: tube xdat ydat rval ['stl'='']
 -- MGL command: tube xdat ydat zdat rdat ['stl'='']
 -- MGL command: tube xdat ydat zdat rval ['stl'='']
 -- Method on mglGraph: void Tube (const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Tube (const mglDataA &y, mreal r, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Tube (const mglDataA &x, const mglDataA &y, const mglDataA &r, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Tube (const mglDataA &x, const mglDataA &y, mreal r, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Tube (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *pen="", const char *opt="")
 -- Method on mglGraph: void Tube (const mglDataA &x, const mglDataA &y, const mglDataA &z, mreal r, const char *pen="", const char *opt="")
 -- C function: void mgl_tube_r (HMGL gr, HCDT y, HCDT r, const char *pen, const char *opt)
 -- C function: void mgl_tube (HMGL gr, HCDT y, mreal r, const char *pen, const char *opt)
 -- C function: void mgl_tube_xyr (HMGL gr, HCDT x, HCDT y, HCDT r, const char *pen, const char *opt)
 -- C function: void mgl_tube_xy (HMGL gr, HCDT x, HCDT y, mreal r, const char *pen, const char *opt)
 -- C function: void mgl_tube_xyzr (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *pen, const char *opt)
 -- C function: void mgl_tube_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, mreal r, const char *pen, const char *opt)
     These functions draw the tube with variable radius R[i] along the curve between points {X[i], Y[i], Z[i]}. Option value set the number of segments at cross-section (default is 25). See also plot. tube sample

 -- MGL command: torus rdat zdat ['stl'='']
 -- Method on mglGraph: void Torus (const mglDataA &r, const mglDataA &z, const char *pen="", const char *opt="")
 -- C function: void mgl_torus (HMGL gr, HCDT r, HCDT z, const char *pen, const char *opt)
     These functions draw surface which is result of curve {R, Z} rotation around axis. If string PEN contain symbols x or z then rotation axis will be set to specified direction (default is y). If string PEN have symbol # then wire plot is produced. If string PEN have symbol . then plot by dots is produced. See also plot, axial. torus sample

 -- MGL command: lamerey x0 ydat ['stl'='']
 -- MGL command: lamerey x0 'y(x)' ['stl'='']
 -- Method on mglGraph: void Lamerey (double x0, const mglDataA &y, const char *stl="", const char *opt="")
 -- Method on mglGraph: void Lamerey (double x0, const char *y, const char *stl="", const char *opt="")
 -- C function: void mgl_lamerey_dat (HMGL gr, double x0, HCDT y, const char *stl, const char *opt)
 -- C function: void mgl_lamerey_str (HMGL gr, double x0, const char *y, const char *stl, const char *opt)
     These functions draw Lamerey diagram for mapping x_new = y(x_old) starting from point X0. String STL may contain line style, symbol v for drawing arrows, symbol ~ for disabling first segment. Option value set the number of segments to be drawn (default is 20). See also plot, fplot, bifurcation, pmap. lamerey sample

 -- MGL command: bifurcation dx ydat ['stl'='']
 -- MGL command: bifurcation dx 'y(x)' ['stl'='']
 -- Method on mglGraph: void Bifurcation (double dx, const mglDataA &y, const char *stl="", const char *opt="")
 -- Method on mglGraph: void Bifurcation (double dx, const char *y, const char *stl="", const char *opt="")
 -- C function: void mgl_bifurcation_dat (HMGL gr, double dx, HCDT y, const char *stl, const char *opt)
 -- C function: void mgl_bifurcation_str (HMGL gr, double dx, const char *y, const char *stl, const char *opt)
     These functions draw bifurcation diagram for mapping x_new = y(x_old). Parameter DX set the accuracy along x-direction. String STL set color. Option value set the number of stationary points (default is 1024). See also plot, fplot, lamerey. bifurcation sample

 -- MGL command: pmap ydat sdat ['stl'='']
 -- MGL command: pmap xdat ydat sdat ['stl'='']
 -- MGL command: pmap xdat ydat zdat sdat ['stl'='']
 -- Method on mglGraph: void Pmap (const mglDataA &y, const mglDataA &s, const char *stl="", const char *opt="")
 -- Method on mglGraph: void Pmap (const mglDataA &x, const mglDataA &y, const mglDataA &s, const char *stl="", const char *opt="")
 -- Method on mglGraph: void Pmap (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &s, const char *stl="", const char *opt="")
 -- C function: void mgl_pmap (HMGL gr, HMDT y, HCDT s, const char *stl, const char *opt)
 -- C function: void mgl_pmap_xy (HMGL gr, HCDT x, HMDT y, HCDT s, const char *stl, const char *opt)
 -- C function: void mgl_pmap_xyz (HMGL gr, HCDT x, HMDT y, HCDT z, HCDT s, const char *stl, const char *opt)
     These functions draw Poincare map for curve {X, Y, Z} at surface S=0. Basically, it show intersections of the curve and the surface. String STL set the style of marks. See also plot, mark, lamerey. pmap sample

external

2D plotting
===========

nav

These functions perform plotting of 2D data. 2D means that data depend from 2 independent parameters like matrix f(x_i,y_j), i=1...n, j=1...m.  By default (if absent) values of X, Y are equidistantly distributed in axis range. The plots are drawn for each z slice of the data. The minor dimensions of arrays X, Y, Z should be equal x.nx=z.nx && y.nx=z.ny or x.nx=y.nx=z.nx && x.ny=y.ny=z.ny. Arrays X and Y can be vectors (not matrices as Z). String SCH sets the color scheme (see Color scheme) for plot. String OPT contain command options (see Command options).

 -- MGL command: surf zdat ['sch'='']
 -- MGL command: surf xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Surf (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Surf (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_surf (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_surf_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws surface specified parametrically {X[i,j], Y[i,j], Z[i,j]}. If string SCH have symbol # then grid lines are drawn. If string SCH have symbol . then plot by dots is produced. See also mesh, dens, belt, tile, boxs, surfc, surfa. surf sample

 -- MGL command: mesh zdat ['sch'='']
 -- MGL command: mesh xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Mesh (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Mesh (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_mesh (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_mesh_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws mesh lines for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]}. See also surf, fall, meshnum, cont, tens. mesh sample

 -- MGL command: fall zdat ['sch'='']
 -- MGL command: fall xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Fall (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Fall (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_fall (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_fall_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws fall lines for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]}. This plot can be used for plotting several curves shifted in depth one from another. If SCH contain x then lines are drawn along x-direction else (by default) lines are drawn along y-direction. See also belt, mesh, tens, meshnum. fall sample

 -- MGL command: belt zdat ['sch'='']
 -- MGL command: belt xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Belt (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Belt (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_belt (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_belt_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws belts for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]}. This plot can be used as 3d generalization of plot). If SCH contain x then belts are drawn along x-direction else (by default) belts are drawn along y-direction. See also fall, surf, beltc, plot, meshnum. belt sample

 -- MGL command: boxs zdat ['sch'='']
 -- MGL command: boxs xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Boxs (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Boxs (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_boxs (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_boxs_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws vertical boxes for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]}. Symbol @ in SCH set to draw filled boxes. See also surf, dens, tile, step. boxs sample

 -- MGL command: tile zdat ['sch'='']
 -- MGL command: tile xdat ydat zdat ['sch'='']
 -- MGL command: tile xdat ydat zdat cdat ['sch'='']
 -- Method on mglGraph: void Tile (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Tile (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Tile (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- C function: void mgl_tile (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_tile_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_tile_xyc (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
     The function draws horizontal tiles for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} and color it by matrix C[i,j] (C=Z if C is not provided). If string SCH contain style x or y then tiles will be oriented perpendicular to x- or y-axis. Such plot can be used as 3d generalization of step. See also surf, boxs, step, tiles. tile sample

 -- MGL command: dens zdat ['sch'='']
 -- MGL command: dens xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Dens (const mglDataA &z, const char *sch="", const char *opt="", mreal zVal=NAN)
 -- Method on mglGraph: void Dens (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="", mreal zVal=NAN)
 -- C function: void mgl_dens (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_dens_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws density plot for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} at Z equal to minimal z-axis value. If string SCH have symbol # then grid lines are drawn. If string SCH have symbol . then plot by dots is produced. See also surf, cont, contf, boxs, tile, dens[xyz]. dens sample

 -- MGL command: cont vdat zdat ['sch'='']
 -- MGL command: cont vdat xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Cont (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Cont (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_cont_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_cont_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws contour lines for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} at Z=V[k], or at Z equal to minimal z-axis value if SCH contain symbol _. Contours are plotted for Z[i,j]=V[k] where V[k] are values of data array V. If string SCH have symbol t or T then contour labels V[k] will be drawn below (or above) the contours. See also dens, contf, contd, axial, cont[xyz]. cont sample

 -- MGL command: cont zdat ['sch'='']
 -- MGL command: cont xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Cont (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Cont (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_cont (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_cont_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The same as previous with vector V of NUM-th elements equidistantly distributed in color range. Here NUM is equal to parameter value in options OPT (default is 7). If string SCH contain symbol . then only contours at levels with saddle points will be drawn.

 -- MGL command: cont val adat xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void ContGen (mreal val, const mglDataA &a, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_cont_gen (HMGL gr, mreal val, HCDT a, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     Draws contour lines for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} at A[i,j]=VAL. If string SCH have symbol t or T then contour labels V[k] will be drawn below (or above) the contours.

 -- MGL command: contf vdat zdat ['sch'='']
 -- MGL command: contf vdat xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void ContF (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void ContF (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_contf_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_contf_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws solid (or filled) contour lines for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} at Z=V[k], or at Z equal to minimal z-axis value if SCH contain symbol _. Contours are plotted for Z[i,j]=V[k] where V[k] are values of data array V (must be v.nx>2). See also dens, cont, contd, contf[xyz]. contf sample

 -- MGL command: contf zdat ['sch'='']
 -- MGL command: contf xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void ContF (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void ContF (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_contf (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_contf_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The same as previous with vector V of NUM-th elements equidistantly distributed in color range. Here NUM is equal to parameter value in options OPT (default is 7).

 -- MGL command: contf v1 v2 adat xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void ContFGen (mreal v1, mreal v2, const mglDataA &a, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_contf_gen (HMGL gr, mreal v1, mreal v2, HCDT a, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     Draws solid (or filled) contour lines for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} between A[i,j]=V1 and A[i,j]=V2.

 -- MGL command: contd vdat zdat ['sch'='']
 -- MGL command: contd vdat xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void ContD (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void ContD (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_contd_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_contd_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws solid (or filled) contour lines for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} at Z=V[k] (or at Z equal to minimal z-axis value if SCH contain symbol _) with manual colors. Contours are plotted for Z[i,j]=V[k] where V[k] are values of data array V (must be v.nx>2). String SCH sets the contour colors: the color of k-th contour is determined by character sch[k%strlen(sch)]. See also dens, cont, contf. contd sample

 -- MGL command: contd zdat ['sch'='']
 -- MGL command: contd xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void ContD (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void ContD (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_contd (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_contd_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The same as previous with vector V of NUM-th elements equidistantly distributed in color range. Here NUM is equal to parameter value in options OPT (default is 7).

 -- MGL command: contp vdat xdat ydat zdat adat ['sch'='']
 -- Method on mglGraph: void ContP (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
 -- C function: void mgl_contp_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
     The function draws contour lines on surface specified parametrically {X[i,j], Y[i,j], Z[i,j]}. Contours are plotted for A[i,j]=V[k] where V[k] are values of data array V. If string SCH have symbol t or T then contour labels V[k] will be drawn below (or above) the contours. If string SCH have symbol f then solid contours will be drawn. See also cont, contf, surfc, cont[xyz].

 -- MGL command: contp xdat ydat zdat adat ['sch'='']
 -- Method on mglGraph: void ContP (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
 -- C function: void mgl_contp (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
     The same as previous with vector V of NUM-th elements equidistantly distributed in color range. Here NUM is equal to parameter value in options OPT (default is 7).

 -- MGL command: contv vdat zdat ['sch'='']
 -- MGL command: contv vdat xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void ContV (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void ContV (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_contv_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_contv_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws vertical cylinder (tube) at contour lines for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} at Z=V[k], or at Z equal to minimal z-axis value if SCH contain symbol _. Contours are plotted for Z[i,j]=V[k] where V[k] are values of data array V. See also cont, contf. contv sample

 -- MGL command: contv zdat ['sch'='']
 -- MGL command: contv xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void ContV (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void ContV (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_contv (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_contv_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The same as previous with vector V of NUM-th elements equidistantly distributed in color range. Here NUM is equal to parameter value in options OPT (default is 7).

 -- MGL command: axial vdat zdat ['sch'='']
 -- MGL command: axial vdat xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Axial (const mglDataA &v, const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Axial (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_axial_val (HMGL gr, HCDT v, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_axial_xy_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws surface which is result of contour plot rotation for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]}. Contours are plotted for Z[i,j]=V[k] where V[k] are values of data array V. If string SCH have symbol # then wire plot is produced. If string SCH have symbol . then plot by dots is produced. If string contain symbols x or z then rotation axis will be set to specified direction (default is y). See also cont, contf, torus, surf3. axial sample

 -- MGL command: axial zdat ['sch'='']
 -- MGL command: axial xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Axial (const mglDataA &z, const char *sch="", const char *opt="", int num=3)
 -- Method on mglGraph: void Axial (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="", int num=3)
 -- C function: void mgl_axial (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_axial_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The same as previous with vector V of NUM-th elements equidistantly distributed in color range. Here NUM is equal to parameter value in options OPT (default is 3).

 -- MGL command: grid2 zdat ['sch'='']
 -- MGL command: grid2 xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Grid (const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Grid (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_grid (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_grid_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws grid lines for density plot of surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} at Z equal to minimal z-axis value. See also dens, cont, contf, grid3, meshnum.

external

3D plotting
===========

nav

These functions perform plotting of 3D data. 3D means that data depend from 3 independent parameters like matrix f(x_i,y_j,z_k), i=1...n, j=1...m, k=1...l. By default (if absent) values of X, Y, Z are equidistantly distributed in axis range. The minor dimensions of arrays X, Y, Z, A should be equal x.nx=a.nx && y.nx=a.ny && z.nz=a.nz or x.nx=y.nx=z.nx=a.nx && x.ny=y.ny=z.ny=a.ny && x.nz=y.nz=z.nz=a.nz. Arrays X, Y and Z can be vectors (not matrices as A). String SCH sets the color scheme (see Color scheme) for plot. String OPT contain command options (see Command options).

 -- MGL command: surf3 adat val ['sch'='']
 -- MGL command: surf3 xdat ydat zdat adat val ['sch'='']
 -- Method on mglGraph: void Surf3 (mreal val, const mglDataA &a, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Surf3 (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
 -- C function: void mgl_surf3_val (HMGL gr, mreal val, HCDT a, const char *sch, const char *opt)
 -- C function: void mgl_surf3_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
     The function draws isosurface plot for 3d array specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]) at A(x,y,z)=VAL. If string contain # then wire plot is produced. If string SCH have symbol . then plot by dots is produced. Note, that there is possibility of incorrect plotting due to uncertainty of cross-section defining if there are two or more isosurface intersections inside one cell. See also cloud, dens3, surf3c, surf3a, axial. surf3 sample

 -- MGL command: surf3 adat ['sch'='']
 -- MGL command: surf3 xdat ydat zdat adat ['sch'='']
 -- Method on mglGraph: void Surf3 (const mglDataA &a, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Surf3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
 -- C function: void mgl_surf3 (HMGL gr, HCDT a, const char *sch, const char *opt)
 -- C function: void mgl_surf3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
     Draws NUM-th uniformly distributed in color range isosurfaces for 3d data. Here NUM is equal to parameter value in options OPT (default is 3).

 -- MGL command: cloud adat ['sch'='']
 -- MGL command: cloud xdat ydat zdat adat ['sch'='']
 -- Method on mglGraph: void Cloud (const mglDataA &a, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Cloud (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
 -- C function: void mgl_cloud (HMGL gr, HCDT a, const char *sch, const char *opt)
 -- C function: void mgl_cloud_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
     The function draws cloud plot for 3d data specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]). This plot is a set of cubes with color and transparency proportional to value of A. The resulting plot is like cloud -- low value is transparent but higher ones are not. The number of plotting cells depend on meshnum. If string SCH contain symbol . then lower quality plot will produced with much low memory usage. If string SCH contain symbol i then transparency will be inversed, i.e. higher become transparent and lower become not transparent. See also surf3, meshnum. cloud sample

 -- MGL command: dens3 adat ['sch'='' sval=-1]
 -- MGL command: dens3 xdat ydat zdat adat ['sch'='' sval=-1]
 -- Method on mglGraph: void Dens3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- Method on mglGraph: void Dens3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- C function: void mgl_dens3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
 -- C function: void mgl_dens3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
     The function draws density plot for 3d data specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]). Density is plotted at slice SVAL in direction {x, y, z} if SCH contain corresponding symbol (by default, y direction is used). If string STL have symbol # then grid lines are drawn. See also cont3, contf3, dens, grid3. dens3 sample

 -- MGL command: cont3 vdat adat ['sch'='' sval=-1]
 -- MGL command: cont3 vdat xdat ydat zdat adat ['sch'='' sval=-1]
 -- Method on mglGraph: void Cont3 (const mglDataA &v, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- Method on mglGraph: void Cont3 (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- C function: void mgl_cont3_val (HMGL gr, HCDT v, HCDT a, const char *sch, mreal sVal, const char *opt)
 -- C function: void mgl_cont3_xyz_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
     The function draws contour plot for 3d data specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]). Contours are plotted for values specified in array V at slice SVAL in direction {x, y, z} if SCH contain corresponding symbol (by default, y direction is used). If string SCH have symbol # then grid lines are drawn. If string SCH have symbol t or T then contour labels will be drawn below (or above) the contours. See also dens3, contf3, cont, grid3. cont3 sample

 -- MGL command: cont3 adat ['sch'='' sval=-1]
 -- MGL command: cont3 xdat ydat zdat adat ['sch'='' sval=-1]
 -- Method on mglGraph: void Cont3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- Method on mglGraph: void Cont3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- C function: void mgl_cont3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
 -- C function: void mgl_cont3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
     The same as previous with vector V of NUM-th elements equidistantly distributed in color range. Here NUM is equal to parameter value in options OPT (default is 7).

 -- MGL command: contf3 vdat adat ['sch'='' sval=-1]
 -- MGL command: contf3 vdat xdat ydat zdat adat ['sch'='' sval=-1]
 -- Method on mglGraph: void Contf3 (const mglDataA &v, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- Method on mglGraph: void Contf3 (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- C function: void mgl_contf3_val (HMGL gr, HCDT v, HCDT a, const char *sch, mreal sVal, const char *opt)
 -- C function: void mgl_contf3_xyz_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
     The function draws solid (or filled) contour plot for 3d data specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]). Contours are plotted for values specified in array V at slice SVAL in direction {x, y, z} if SCH contain corresponding symbol (by default, y direction is used). If string SCH have symbol # then grid lines are drawn. See also dens3, cont3, contf, grid3. contf3 sample

 -- MGL command: contf3 adat ['sch'='' sval=-1]
 -- MGL command: contf3 xdat ydat zdat adat ['sch'='' sval=-1]
 -- Method on mglGraph: void Contf3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- Method on mglGraph: void Contf3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- C function: void mgl_contf3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
 -- C function: void mgl_contf3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
     The same as previous with vector V of NUM-th elements equidistantly distributed in color range. Here NUM is equal to parameter value in options OPT (default is 7).

 -- MGL command: grid3 adat ['sch'='' sval=-1]
 -- MGL command: grid3 xdat ydat zdat adat ['sch'='' sval=-1]
 -- Method on mglGraph: void Grid3 (const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- Method on mglGraph: void Grid3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", mreal sVal=-1, const char *opt="")
 -- C function: void mgl_grid3 (HMGL gr, HCDT a, const char *sch, mreal sVal, const char *opt)
 -- C function: void mgl_grid3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, mreal sVal, const char *opt)
     The function draws grid for 3d data specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]). Grid is plotted at slice SVAL in direction {x, y, z} if SCH contain corresponding symbol (by default, y direction is used). See also cont3, contf3, dens3, grid2, meshnum.

 -- MGL command: dcont vdat adat bdat ['sch'='']
 -- MGL command: dcont vdat xdat ydat zdat adat bdat ['sch'='']
 -- Method on mglGraph: void DCont (const mglDataA &v, const mglDataA &a, const mglDataA &b, const char *sch="", const char *opt="")
 -- Method on mglGraph: void DCont (const mglDataA &v, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &b, const char *sch="", const char *opt="")
 -- C function: void mgl_dcont_val (HMGL gr, HCDT v, HCDT a, HCDT b, const char *sch, const char *opt)
 -- C function: void mgl_dcont_xyz_val (HMGL gr, HCDT v, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *sch, const char *opt)
     The function draws lines at intersections of isosurfaces for 3d data A, B specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]). Isosurfaces are taken for values specified in array V. See also cont, cont3. dcont sample

 -- MGL command: dcont adat bdat ['sch'='' sval=-1]
 -- MGL command: dcont xdat ydat zdat adat bdat ['sch'='' sval=-1]
 -- Method on mglGraph: void DCont (const mglDataA &a, const mglDataA &b, const char *sch="", const char *opt="")
 -- Method on mglGraph: void DCont (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &b, const char *sch="", const char *opt="")
 -- C function: void mgl_dcont (HMGL gr, HCDT a, HCDT b, const char *sch, mreal sVal, const char *opt)
 -- C function: void mgl_HCDT b, cont_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT b, const char *sch, const char *opt)
     The same as previous with vector V of NUM-th elements equidistantly distributed in color range. Here NUM is equal to parameter value in options OPT (default is 7).

 -- MGL command: beam tr g1 g2 adat rval ['sch'='' flag=0 num=3]
 -- Method on mglGraph: void Beam (const mglDataA &tr, const mglDataA &g1, const mglDataA &g2, const mglDataA &a, mreal r, const char *stl="", int flag=0, int num=3)
 -- Method on mglGraph: void Beam (mreal val, const mglDataA &tr, const mglDataA &g1, const mglDataA &g2, const mglDataA &a, mreal r, const char *stl="", int flag=0)
 -- C function: void mgl_beam (HMGL gr, HCDT tr, HCDT g1, HCDT g2, HCDT a, mreal r, const char *stl, int flag, int num)
 -- C function: void mgl_beam_val (HMGL gr, mreal val, HCDT tr, HCDT g1, HCDT g2, HCDT a, mreal r, const char *stl, int flag)
     Draws the isosurface for 3d array A at constant values of A=VAL. This is special kind of plot for A specified in accompanied coordinates along curve TR with orts G1, G2 and with transverse scale R. Variable FLAG is bitwise: 0x1 - draw in accompanied (not laboratory) coordinates; 0x2 - draw projection to \rho-z plane; 0x4 - draw normalized in each slice field. The x-size of data arrays TR, G1, G2 must be nx>2. The y-size of data arrays TR, G1, G2 and z-size of the data array A must be equal. See also surf3.

external

Dual plotting
=============

nav

These plotting functions draw two matrix simultaneously. There are 5 generally different types of data representations: surface or isosurface colored by other data (SurfC, Surf3C), surface or isosurface transpared by other data (SurfA, Surf3A), tiles with variable size (TileS), mapping diagram (Map), STFA diagram (STFA). By default (if absent) values of X, Y, Z are equidistantly distributed in axis range. The minor dimensions of arrays X, Y, Z, C should be equal. Arrays X, Y (and Z for Surf3C, Surf3A) can be vectors (not matrices as C). String SCH sets the color scheme (see Color scheme) for plot. String OPT contain command options (see Command options).

 -- MGL command: surfc zdat cdat ['sch'='']
 -- MGL command: surfc xdat ydat zdat cdat ['sch'='']
 -- Method on mglGraph: void SurfC (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void SurfC (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- C function: void mgl_surfc (HMGL gr, HCDT z, HCDT c, const char *sch, const char *opt)
 -- C function: void mgl_surfc_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
     The function draws surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} and color it by matrix C[i,j]. If string SCH have symbol # then grid lines are drawn. If string SCH have symbol . then plot by dots is produced. All dimensions of arrays Z and C must be equal. Surface is plotted for each z slice of the data. See also surf, surfa, surfca, beltc, surf3c. surfc sample

 -- MGL command: beltc zdat cdat ['sch'='']
 -- MGL command: beltc xdat ydat zdat cdat ['sch'='']
 -- Method on mglGraph: void BeltC (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void BeltC (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- C function: void mgl_beltc (HMGL gr, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_beltc_xy (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws belts for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} and color it by matrix C[i,j]. This plot can be used as 3d generalization of plot). If SCH contain x then belts are drawn along x-direction else (by default) belts are drawn along y-direction. See also belt, surfc, meshnum. beltc sample

 -- MGL command: surf3c adat cdat val ['sch'='']
 -- MGL command: surf3c xdat ydat zdat adat cdat val ['sch'='']
 -- Method on mglGraph: void Surf3C (mreal val, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Surf3C (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
 -- C function: void mgl_surf3c_val (HMGL gr, mreal val, HCDT a, HCDT c, const char *sch, const char *opt)
 -- C function: void mgl_surf3c_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
     The function draws isosurface plot for 3d array specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]) at A(x,y,z)=VAL. It is mostly the same as surf3 function but the color of isosurface depends on values of array C. If string SCH contain # then wire plot is produced. If string SCH have symbol . then plot by dots is produced. See also surf3, surfc, surf3a, surf3ca. surf3c sample

 -- MGL command: surf3c adat cdat ['sch'='']
 -- MGL command: surf3c xdat ydat zdat adat cdat ['sch'='']
 -- Method on mglGraph: void Surf3C (const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Surf3C (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
 -- C function: void mgl_surf3c (HMGL gr, HCDT a, HCDT c, const char *sch, const char *opt)
 -- C function: void mgl_surf3c_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
     Draws NUM-th uniformly distributed in color range isosurfaces for 3d data. Here NUM is equal to parameter value in options OPT (default is 3).

 -- MGL command: surfa zdat cdat ['sch'='']
 -- MGL command: surfa xdat ydat zdat cdat ['sch'='']
 -- Method on mglGraph: void SurfA (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void SurfA (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- C function: void mgl_surfa (HMGL gr, HCDT z, HCDT c, const char *sch, const char *opt)
 -- C function: void mgl_surfa_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
     The function draws surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} and transparent it by matrix C[i,j]. If string SCH have symbol # then grid lines are drawn. If string SCH have symbol . then plot by dots is produced. All dimensions of arrays Z and C must be equal. Surface is plotted for each z slice of the data. See also surf, surfc, surfca, surf3a. surfa sample

 -- MGL command: surf3a adat cdat val ['sch'='']
 -- MGL command: surf3a xdat ydat zdat adat cdat val ['sch'='']
 -- Method on mglGraph: void Surf3A (mreal val, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Surf3A (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
 -- C function: void mgl_surf3a_val (HMGL gr, mreal val, HCDT a, HCDT c, const char *sch, const char *opt)
 -- C function: void mgl_surf3a_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
     The function draws isosurface plot for 3d array specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]) at A(x,y,z)=VAL. It is mostly the same as surf3 function but the transparency of isosurface depends on values of array C. If string SCH contain # then wire plot is produced. If string SCH have symbol . then plot by dots is produced. See also surf3, surfc, surf3a, surf3ca. surf3a sample

 -- MGL command: surf3a adat cdat ['sch'='']
 -- MGL command: surf3a xdat ydat zdat adat cdat ['sch'='']
 -- Method on mglGraph: void Surf3A (const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Surf3A (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const char *sch="", const char *opt="")
 -- C function: void mgl_surf3a (HMGL gr, HCDT a, HCDT c, const char *sch, const char *opt)
 -- C function: void mgl_surf3a_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, const char *sch, const char *opt)
     Draws NUM-th uniformly distributed in color range isosurfaces for 3d data. At this array C can be vector with values of transparency and NUM=C.nx. In opposite case NUM is equal to parameter value in options OPT (default is 3).

 -- MGL command: surfca zdat cdat adat ['sch'='']
 -- MGL command: surfca xdat ydat zdat cdat adat ['sch'='']
 -- Method on mglGraph: void SurfCA (const mglDataA &z, const mglDataA &c, const mglDataA &a, const char *sch="", const char *opt="")
 -- Method on mglGraph: void SurfCA (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const mglDataA &a, const char *sch="", const char *opt="")
 -- C function: void mgl_surfca (HMGL gr, HCDT z, HCDT c, HCDT a, const char *sch, const char *opt)
 -- C function: void mgl_surfca_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, HCDT a, const char *sch, const char *opt)
     The function draws surface specified parametrically {X[i,j], Y[i,j], Z[i,j]}, color it by matrix C[i,j] and transparent it by matrix A[i,j]. If string SCH have symbol # then grid lines are drawn. If string SCH have symbol . then plot by dots is produced. All dimensions of arrays Z and C must be equal. Surface is plotted for each z slice of the data. Note, you can use map-like coloring if use % in color scheme. See also surf, surfc, surfa, surf3ca. surfca sample

 -- MGL command: surf3ca adat cdat bdat val ['sch'='']
 -- MGL command: surf3ca xdat ydat zdat adat cdat bdat val ['sch'='']
 -- Method on mglGraph: void Surf3CA (mreal val, const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Surf3CA (mreal val, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
 -- C function: void mgl_surf3ca_val (HMGL gr, mreal val, HCDT a, HCDT c, HCDT b, const char *sch, const char *opt)
 -- C function: void mgl_surf3ca_xyz_val (HMGL gr, mreal val, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, HCDT b,const char *sch, const char *opt)
     The function draws isosurface plot for 3d array specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]) at A(x,y,z)=VAL. It is mostly the same as surf3 function but the color and the transparency of isosurface depends on values of array C and B correspondingly. If string SCH contain # then wire plot is produced. If string SCH have symbol . then plot by dots is produced. Note, you can use map-like coloring if use % in color scheme. See also surf3, surfca, surf3c, surf3a. surf3ca sample

 -- MGL command: surf3ca adat cdat bdat ['sch'='']
 -- MGL command: surf3ca xdat ydat zdat adat cdat bdat ['sch'='']
 -- Method on mglGraph: void Surf3CA (const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Surf3CA (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &c, const mglDataA &b, const char *sch="", const char *opt="")
 -- C function: void mgl_surf3ca (HMGL gr, HCDT a, HCDT c, HCDT b, const char *sch, const char *opt)
 -- C function: void mgl_surf3ca_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT c, HCDT b, const char *sch, const char *opt)
     Draws NUM-th uniformly distributed in color range isosurfaces for 3d data. Here parameter NUM is equal to parameter value in options OPT (default is 3).

 -- MGL command: tiles zdat rdat ['sch'='']
 -- MGL command: tiles xdat ydat zdat rdat ['sch'='']
 -- MGL command: tiles xdat ydat zdat rdat cdat ['sch'='']
 -- Method on mglGraph: void TileS (const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void TileS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const char *sch="", const char *opt="")
 -- Method on mglGraph: void TileS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &r, const mglDataA &c, const char *sch="", const char *opt="")
 -- C function: void mgl_tiles (HMGL gr, HCDT z, HCDT c, const char *sch, const char *opt)
 -- C function: void mgl_tiles_xy (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, const char *sch, const char *opt)
 -- C function: void mgl_tiles_xyc (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT r, HCDT c, const char *sch, const char *opt)
     The function draws horizontal tiles for surface specified parametrically {X[i,j], Y[i,j], Z[i,j]} and color it by matrix C[i,j]. It is mostly the same as tile but the size of tiles is determined by R array. If string SCH contain style x or y then tiles will be oriented perpendicular to x- or y-axis. This is some kind of ``transparency'' useful for exporting to EPS files. Tiles is plotted for each z slice of the data. See also surfa, tile. tiles sample

 -- MGL command: map udat vdat ['sch'='']
 -- MGL command: map xdat ydat udat vdat ['sch'='']
 -- Method on mglGraph: void Map (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Map (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- C function: void mgl_map (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
 -- C function: void mgl_map_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
     The function draws mapping plot for matrices {AX, AY } which parametrically depend on coordinates X, Y. The initial position of the cell (point) is marked by color. Height is proportional to Jacobian(ax,ay). This plot is like Arnold diagram ??? If string SCH contain symbol . then the color ball at matrix knots are drawn otherwise face is drawn. Mapping visualization

 -- MGL command: stfa re im dn ['sch'='']
 -- MGL command: stfa xdat ydat re im dn ['sch'='']
 -- Method on mglGraph: void STFA (const mglDataA &re, const mglDataA &im, int dn, const char *sch="", const char *opt="")
 -- Method on mglGraph: void STFA (const mglDataA &x, const mglDataA &y, const mglDataA &re, const mglDataA &im, int dn, const char *sch="", const char *opt="")
 -- C function: void mgl_stfa (HMGL gr, HCDT re, HCDT im, int dn, const char *sch, const char *opt)
 -- C function: void mgl_stfa_xy (HMGL gr, HCDT x, HCDT y, HCDT re, HCDT im, int dn, const char *sch, const char *opt)
     Draws spectrogram of complex array RE+i*IM for Fourier size of DN points at plane Z equal to minimal z-axis value. For example in 1D case, result is density plot of data res[i,j]=|\sum_d^dn exp(I*j*d)*(re[i*dn+d]+I*im[i*dn+d])|/dn with size {int(nx/dn), dn, ny}. At this array RE, IM parametrically depend on coordinates X, Y. The size of RE and IM must be the same. The minor dimensions of arrays X, Y, RE should be equal. Arrays X, Y can be vectors (not matrix as RE).  stfa sample

external

Vector fields
=============

nav

These functions perform plotting of 2D and 3D vector fields. There are 5 generally different types of vector fields representations: simple vector field (Vect), vectors along the curve (Traj), vector field by dew-drops (Dew), flow threads (Flow, FlowP), flow pipes (Pipe). By default (if absent) values of X, Y, Z are equidistantly distributed in axis range. The minor dimensions of arrays X, Y, Z, AX should be equal. The size of AX, AY and AZ must be equal. Arrays X, Y, Z can be vectors (not matrices as AX). String SCH sets the color scheme (see Color scheme) for plot. String OPT contain command options (see Command options).

 -- MGL command: lines y1dat y2dat ['sch'='']
 -- MGL command: lines x1dat y1dat x2dat y2dat ['sch'='']
 -- MGL command: lines x1dat y1dat z1dat x2dat y2dat z2dat ['sch'='']
 -- Method on mglGraph: void Lines (const mglDataA &y1, const mglDataA &y2, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Lines (const mglDataA &x1, const mglDataA &y1, const mglDataA &x2, const mglDataA &y2, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Lines (const mglDataA &x1, const mglDataA &y1, const mglDataA &z1, const mglDataA &x2, const mglDataA &y2, const mglDataA &z2, const char *sch="", const char *opt="")
 -- C function: void mgl_lines_xyz (HMGL gr, HCDTx1, HCDTy1, HCDTz1, HCDTx2, HCDTy2, HCDTz2, const char *sch, const char *opt)
 -- C function: void mgl_lines_xy (HMGL gr, HCDTx1, HCDTy1, HCDTx2, HCDTy2, const char *sch, const char *opt)
 -- C function: void mgl_lines (HMGL gr, HCDTy1, HCDTy2, const char *sch, const char *opt)
     The function draws lines between points {X1, Y1, Z1} and {X2, Y2, Z2}. String PEN specifies the color (see Line styles). By default (pen="") color from palette is used (see Palette and colors). The minor sizes of all arrays must be the same. The plots are drawn for each row if one of the data is the matrix. See also plot, traj. lines sample

 -- MGL command: traj xdat ydat udat vdat ['sch'='']
 -- MGL command: traj xdat ydat zdat udat vdat wdat ['sch'='']
 -- Method on mglGraph: void Traj (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Traj (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
 -- C function: void mgl_traj_xyz (HMGL gr, HCDTx, HCDTy, HCDTz, HCDTax, HCDTay, HCDTaz, const char *sch, const char *opt)
 -- C function: void mgl_traj_xy (HMGL gr, HCDTx, HCDTy, HCDTax, HCDTay, const char *sch, const char *opt)
     The function draws vectors {AX, AY, AZ} along a curve {X, Y, Z}. The length of arrows are proportional to \sqrt{ax^2+ay^2+az^2}. String PEN specifies the color (see Line styles). By default (pen="") color from palette is used (see Palette and colors). Option value set the vector length factor (if non-zero) or vector length to be proportional the distance between curve points (if value=0). The minor sizes of all arrays must be equal and large 2. The plots are drawn for each row if one of the data is the matrix. See also vect. traj sample

 -- MGL command: vect udat vdat ['sch'='']
 -- MGL command: vect xdat ydat udat vdat ['sch'='']
 -- Method on mglGraph: void Vect (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Vect (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- C function: void mgl_vect_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
 -- C function: void mgl_vect_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
     The function draws plane vector field plot for the field {AX, AY} depending parametrically on coordinates X, Y at level Z equal to minimal z-axis value. The length and color of arrows are proportional to \sqrt{ax^2+ay^2}. The number of arrows depend on meshnum. The appearance of the hachures (arrows) can be changed by symbols:

       * f for drawing arrows with fixed lengths,

       * >, < for drawing arrows to or from the cell point (default is centering),

       * . for drawing hachures with dots instead of arrows,

       * = for enabling color gradient along arrows.

     See also flow, dew. vect sample

 -- MGL command: vect udat vdat wdat ['sch'='']
 -- MGL command: vect xdat ydat zdat udat vdat wdat ['sch'='']
 -- Method on mglGraph: void Vect (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Vect (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
 -- C function: void mgl_vect_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
 -- C function: void mgl_vect_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
     This is 3D version of the first functions. Here arrays AX, AY, AZ must be 3-ranged tensors with equal sizes and the length and color of arrows is proportional to \sqrt{ax^2+ay^2+az^2}.

 -- MGL command: vect3 udat vdat wdat ['sch'='' sval]
 -- MGL command: vect3 xdat ydat zdat udat vdat wdat ['sch'='' sval]
 -- Method on mglGraph: void Vect3 (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal sVal=-1, const char *opt="")
 -- Method on mglGraph: void Vect3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal sVal=-1, const char *opt="")
 -- C function: void mgl_vect3 (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal sVal, const char *opt)
 -- C function: void mgl_vect3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal sVal, const char *opt)
     The function draws 3D vector field plot for the field {AX, AY, AZ} depending parametrically on coordinates X, Y, Z. Vector field is drawn at slice SVAL in direction {x, y, z} if SCH contain corresponding symbol (by default, y direction is used). The length and color of arrows are proportional to \sqrt{ax^2+ay^2+az^2}. The number of arrows depend on meshnum. The appearance of the hachures (arrows) can be changed by symbols:

       * f for drawing arrows with fixed lengths,

       * >, < for drawing arrows to or from the cell point (default is centering),

       * . for drawing hachures with dots instead of arrows,

       * = for enabling color gradient along arrows.

     See also vect, flow, dew. vect3 sample

 -- MGL command: dew udat vdat ['sch'='']
 -- MGL command: dew xdat ydat udat vdat ['sch'='']
 -- Method on mglGraph: void Dew (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Dew (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- C function: void mgl_dew (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
 -- C function: void mgl_dew_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
     The function draws dew-drops for plane vector field {AX, AY} depending parametrically on coordinates X, Y at level Z equal to minimal z-axis value. Note that this is very expensive plot in memory usage and creation time! The color of drops is proportional to \sqrt{ax^2+ay^2}. The number of drops depend on meshnum. See also vect. dew sample

 -- MGL command: flow udat vdat ['sch'='']
 -- MGL command: flow xdat ydat udat vdat ['sch'='']
 -- Method on mglGraph: void Flow (const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Flow (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- C function: void mgl_flow_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, const char *opt)
 -- C function: void mgl_flow_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
     The function draws flow threads for the plane vector field {AX, AY} parametrically depending on coordinates X, Y at level Z equal to minimal z-axis value. Option value set the approximate number of threads (default is 5), or accuracy for stationary points (if style . is used) . String SCH may contain:

       * color scheme -- up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source);

       * # for starting threads from edges only;

       * . for drawing separatrices only (flow threads to/from stationary points).

       * * for starting threads from a 2D array of points inside the data;

       * v for drawing arrows on the threads;

       * x, z for drawing tapes of normals in x-y and y-z planes correspondingly.

     See also pipe, vect, tape, flow3, barwidth. flow sample

 -- MGL command: flow udat vdat wdat ['sch'='']
 -- MGL command: flow xdat ydat zdat udat vdat wdat ['sch'='']
 -- Method on mglGraph: void Flow (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Flow (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
 -- C function: void mgl_flow_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
 -- C function: void mgl_flow_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
     This is 3D version of the first functions. Here arrays AX, AY, AZ must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrt{ax^2+ay^2+az^2}.

 -- MGL command: flow x0 y0 udat vdat ['sch'='']
 -- MGL command: flow x0 y0 xdat ydat udat vdat ['sch'='']
 -- Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="")
 -- C function: void mgl_flowp_2d (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT ax, HCDT ay, const char *sch, const char *opt)
 -- C function: void mgl_flowp_xy (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, const char *opt)
     The same as first one (flow) but draws single flow thread starting from point P0={X0,Y0,Z0}. String SCH may also contain: > or < for drawing in forward or backward direction only (default is both).

 -- MGL command: flow x0 y0 z0 udat vdat wdat ['sch'='']
 -- MGL command: flow x0 y0 z0 xdat ydat zdat udat vdat wdat ['sch'='']
 -- Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
 -- Method on mglGraph: void FlowP (mglPoint p0, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", const char *opt="")
 -- C function: void mgl_flowp_3d (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
 -- C function: void mgl_flowp_xyz (HMGL gr, mreal x0, mreal y0, mreal z0, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, const char *opt)
     This is 3D version of the previous functions.

 -- MGL command: flow3 udat vdat wdat ['sch'='']
 -- MGL command: flow3 xdat ydat zdat udat vdat ['sch'='']
 -- Method on mglGraph: void Flow3 (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", double sVal=-1, const char *opt="")
 -- Method on mglGraph: void Flow3 (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", double sVal=-1, const char *opt="")
 -- C function: void mgl_flow3 (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, double sVal, const char *opt)
 -- C function: void mgl_flow3_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, double sVal, const char *opt)
     The function draws flow threads for the 3D vector field {AX, AY, AZ} parametrically depending on coordinates X, Y, Z. Flow threads starts from given plane. Option value set the approximate number of threads (default is 5). String SCH may contain:

       * color scheme -- up-half (warm) corresponds to normal flow (like attractor), bottom-half (cold) corresponds to inverse flow (like source);

       * x, z for normal of starting plane (default is y-direction);

       * v for drawing arrows on the threads;

       * t for drawing tapes of normals in x-y and y-z planes.

     See also flow, pipe, vect. flow3 sample

 -- MGL command: grad pdat ['sch'='']
 -- MGL command: grad xdat ydat pdat ['sch'='']
 -- MGL command: grad xdat ydat zdat pdat ['sch'='']
 -- Method on mglGraph: void Grad (const mglDataA &phi, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Grad (const mglDataA &x, const mglDataA &y, const mglDataA &phi, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Grad (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &phi, const char *sch="", const char *opt="")
 -- C function: void mgl_grad (HMGL gr, HCDT phi, const char *sch, const char *opt)
 -- C function: void mgl_grad_xy (HMGL gr, HCDT x, HCDT y, HCDT phi, const char *sch, const char *opt)
 -- C function: void mgl_grad_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT phi, const char *sch, const char *opt)
     The function draws gradient lines for scalar field PHI[i,j] (or PHI[i,j,k] in 3d case) specified parametrically {X[i,j,k], Y[i,j,k], Z[i,j,k]}. Number of lines is proportional to value option (default is 5). See also dens, cont, flow.

 -- MGL command: pipe udat vdat ['sch'='' r0=0.05]
 -- MGL command: pipe xdat ydat udat vdat ['sch'='' r0=0.05]
 -- Method on mglGraph: void Pipe (const mglDataA &ax, const mglDataA &ay, const char *sch="", mreal r0=0.05, const char *opt="")
 -- Method on mglGraph: void Pipe (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", mreal r0=0.05, const char *opt="")
 -- C function: void mgl_pipe_2d (HMGL gr, HCDT ax, HCDT ay, const char *sch, mreal r0, const char *opt)
 -- C function: void mgl_pipe_xy (HMGL gr, HCDT x, HCDT y, HCDT ax, HCDT ay, const char *sch, mreal r0, const char *opt)
     The function draws flow pipes for the plane vector field {AX, AY} parametrically depending on coordinates X, Y at level Z equal to minimal z-axis value. Number of pipes is proportional to value option (default is 5). If # symbol is specified then pipes start only from edges of axis range. The color of lines is proportional to \sqrt{ax^2+ay^2}. Warm color corresponds to normal flow (like attractor). Cold one corresponds to inverse flow (like source). Parameter R0 set the base pipe radius. If R0<0 or symbol i is specified then pipe radius is inverse proportional to amplitude. The vector field is plotted for each z slice of AX, AY. See also flow, vect. pipe sample

 -- MGL command: pipe udat vdat wdat ['sch'='' r0=0.05]
 -- MGL command: pipe xdat ydat zdat udat vdat wdat ['sch'='' r0=0.05]
 -- Method on mglGraph: void Pipe (const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal r0=0.05, const char *opt="")
 -- Method on mglGraph: void Pipe (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &ax, const mglDataA &ay, const mglDataA &az, const char *sch="", mreal r0=0.05, const char *opt="")
 -- C function: void mgl_pipe_3d (HMGL gr, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal r0, const char *opt)
 -- C function: void mgl_pipe_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT ax, HCDT ay, HCDT az, const char *sch, mreal r0, const char *opt)
     This is 3D version of the first functions. Here arrays AX, AY, AZ must be 3-ranged tensors with equal sizes and the color of line is proportional to \sqrt{ax^2+ay^2+az^2}.

external

Other plotting
==============

nav

These functions perform miscellaneous plotting. There is unstructured data points plots (Dots), surface reconstruction (Crust), surfaces on the triangular or quadrangular mesh (TriPlot, TriCont, QuadPlot), textual formula plotting (Plots by formula), data plots at edges (Dens[XYZ], Cont[XYZ], ContF[XYZ]). Each type of plotting has similar interface. There are 2 kind of versions which handle the arrays of data and coordinates or only single data array. Parameters of color scheme are specified by the string argument. See Color scheme.

 -- MGL command: densx dat ['sch'='' sval=nan]
 -- MGL command: densy dat ['sch'='' sval=nan]
 -- MGL command: densz dat ['sch'='' sval=nan]
 -- Method on mglGraph: void DensX (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- Method on mglGraph: void DensY (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- Method on mglGraph: void DensZ (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- C function: void mgl_dens_x (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
 -- C function: void mgl_dens_y (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
 -- C function: void mgl_dens_z (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
     These plotting functions draw density plot in x, y, or z plain. If A is a tensor (3-dimensional data) then interpolation to a given SVAL is performed. These functions are useful for creating projections of the 3D data array to the bounding box. See also ContXYZ, ContFXYZ, dens, Data manipulation. dens_xyz sample

 -- MGL command: contx dat ['sch'='' sval=nan]
 -- MGL command: conty dat ['sch'='' sval=nan]
 -- MGL command: contz dat ['sch'='' sval=nan]
 -- Method on mglGraph: void ContX (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- Method on mglGraph: void ContY (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- Method on mglGraph: void ContZ (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- C function: void mgl_cont_x (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
 -- C function: void mgl_cont_y (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
 -- C function: void mgl_cont_z (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
     These plotting functions draw contour lines in x, y, or z plain. If A is a tensor (3-dimensional data) then interpolation to a given SVAL is performed. These functions are useful for creating projections of the 3D data array to the bounding box. Option value set the number of contours. See also ContFXYZ, DensXYZ, cont, Data manipulation. cont_xyz sample

 -- Method on mglGraph: void ContX (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- Method on mglGraph: void ContY (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- Method on mglGraph: void ContZ (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- C function: void mgl_cont_x_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
 -- C function: void mgl_cont_y_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
 -- C function: void mgl_cont_z_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
     The same as previous with manual contour levels.

 -- MGL command: contfx dat ['sch'='' sval=nan]
 -- MGL command: contfy dat ['sch'='' sval=nan]
 -- MGL command: contfz dat ['sch'='' sval=nan]
 -- Method on mglGraph: void ContFX (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- Method on mglGraph: void ContFY (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- Method on mglGraph: void ContFZ (const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- C function: void mgl_contf_x (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
 -- C function: void mgl_contf_y (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
 -- C function: void mgl_contf_z (HMGL gr, HCDT a, const char *stl, mreal sVal, const char *opt)
     These plotting functions draw solid contours in x, y, or z plain. If A is a tensor (3-dimensional data) then interpolation to a given SVAL is performed. These functions are useful for creating projections of the 3D data array to the bounding box. Option value set the number of contours. See also ContFXYZ, DensXYZ, cont, Data manipulation. contf_xyz sample

 -- Method on mglGraph: void ContFX (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- Method on mglGraph: void ContFY (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- Method on mglGraph: void ContFZ (const mglDataA &v, const mglDataA &a, const char *stl="", mreal sVal=NAN, const char *opt="")
 -- C function: void mgl_contf_x_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
 -- C function: void mgl_contf_y_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
 -- C function: void mgl_contf_z_val (HMGL gr, HCDT v, HCDT a, const char *stl, mreal sVal, const char *opt)
     The same as previous with manual contour levels.

 -- MGL command: fplot 'y(x)' ['pen'='']
 -- Method on mglGraph: void FPlot (const char *eqY, const char *pen="", const char *opt="")
 -- C function: void mgl_fplot (HMGL gr, const char *eqY, const char *pen, const char *opt)
     Draws command function y(x) at plane Z equal to minimal z-axis value, where x variable is changed in xrange. You do not need to create the data arrays to plot it. Option value set initial number of points.  See also plot.

 -- MGL command: fplot 'x(t)' 'y(t)' 'z(t)' ['pen'='']
 -- Method on mglGraph: void FPlot (const char *eqX, const char *eqY, const char *eqZ, const char *pen, const char *opt="")
 -- C function: void mgl_fplot_xyz (HMGL gr, const char *eqX, const char *eqY, const char *eqZ, const char *pen, const char *opt)
     Draws command parametrical curve {x(t), y(t), z(t)} where t variable is changed in range [0, 1]. You do not need to create the data arrays to plot it. Option value set number of points. See also plot.

 -- MGL command: fsurf 'z(x,y)' ['sch'='']
 -- Method on mglGraph: void FSurf (const char *eqZ, const char *sch="", const char *opt="");
 -- C function: void mgl_fsurf (HMGL gr, const char *eqZ, const char *sch, const char *opt);
     Draws command surface for function z(x,y) where x, y variable are changed in xrange, yrange. You do not need to create the data arrays to plot it. Option value set number of points. See also surf.

 -- MGL command: fsurf 'x(u,v)' 'y(u,v)' 'z(u,v)' ['sch'='']
 -- Method on mglGraph: void FSurf (const char *eqX, const char *eqY, const char *eqZ, const char *sch="", const char *opt="")
 -- C function: void mgl_fsurf_xyz (HMGL gr, const char *eqX, const char *eqY, const char *eqZ, const char *sch, const char *opt)
     Draws command parametrical surface {x(u,v), y(u,v), z(u,v)} where u, v variable are changed in range [0, 1]. You do not need to create the data arrays to plot it. Option value set number of points. See also surf.

 -- MGL command: triplot idat xdat ydat ['sch'='']
 -- MGL command: triplot idat xdat ydat zdat ['sch'='']
 -- MGL command: triplot idat xdat ydat zdat cdat ['sch'='']
 -- Method on mglGraph: void TriPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const char *sch="", const char *opt="")
 -- Method on mglGraph: void TriPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void TriPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_triplot_xy (HMGL gr, HCDT id, HCDT x, HCDT y, const char *sch, const char *opt)
 -- C function: void mgl_triplot_xyz (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_triplot_xyzc (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
     The function draws the surface of triangles. Triangle vertexes are set by indexes ID of data points {X[i], Y[i], Z[i]}. String SCH sets the color scheme. If string contain # then wire plot is produced. First dimensions of ID must be 3 or greater. Arrays X, Y, Z must have equal sizes. Parameter C set the colors of triangles (if ID.ny=C.nx) or colors of vertexes (if X.nx=C.nx). See also dots, crust, quadplot, triangulation. triplot sample

 -- MGL command: tricont vdat idat xdat ydat zdat cdat ['sch'='']
 -- MGL command: tricont vdat idat xdat ydat zdat ['sch'='']
 -- MGL command: tricont idat xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void TriCont (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void TriCont (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void TriContV (const mglDataA &v, const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void TriContV (const mglDataA &v, const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_tricont_xyzc (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
 -- C function: void mgl_tricont_xyz (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_tricont_xyzcv (HMGL gr, HCDT v, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
 -- C function: void mgl_tricont_xyzv (HMGL gr, HCDT v, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function draws contour lines for surface of triangles at Z=V[k] (or at  Z equal to minimal z-axis value if SCH contain symbol _). Triangle vertexes are set by indexes ID of data points {X[i], Y[i], Z[i]}. Contours are plotted for Z[i,j]=V[k] where V[k] are values of data array V. If V is absent then arrays of option value elements  equidistantly distributed in color range is used. String SCH sets the color scheme. Array C (if specified) is used for contour coloring. First dimensions of ID must be 3 or greater. Arrays X, Y, Z must have equal sizes. Parameter C set the colors of triangles (if ID.ny=C.nx) or colors of vertexes (if X.nx=C.nx). See also triplot, cont, triangulation.

 -- MGL command: quadplot idat xdat ydat ['sch'='']
 -- MGL command: quadplot idat xdat ydat zdat ['sch'='']
 -- MGL command: quadplot idat xdat ydat zdat cdat ['sch'='']
 -- Method on mglGraph: void QuadPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const char *sch="", const char *opt="")
 -- Method on mglGraph: void QuadPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const char *sch="", const char *opt="")
 -- Method on mglGraph: void QuadPlot (const mglDataA &id, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_quadplot_xy (HMGL gr, HCDT id, HCDT x, HCDT y, const char *sch, const char *opt)
 -- C function: void mgl_quadplot_xyz (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_quadplot_xyzc (HMGL gr, HCDT id, HCDT x, HCDT y, HCDT z, HCDT c, const char *sch, const char *opt)
     The function draws the surface of quadrangles. Quadrangles vertexes are set by indexes ID of data points {X[i], Y[i], Z[i]}. String SCH sets the color scheme. If string contain # then wire plot is produced. First dimensions of ID must be 4 or greater. Arrays X, Y, Z must have equal sizes. Parameter C set the colors of quadrangles (if ID.ny=C.nx) or colors of vertexes (if X.nx=C.nx). See also triplot. triplot sample

 -- MGL command: dots xdat ydat zdat ['sch'='']
 -- MGL command: dots xdat ydat zdat adat ['sch'='']
 -- Method on mglGraph: void Dots (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Dots (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *sch="", const char *opt="")
 -- Method on mglGraph: void Dots (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &c, const mglDataA &a, const char *sch="", const char *opt="")
 -- C function: void mgl_dots (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
 -- C function: void mgl_dots_a (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *sch, const char *opt)
 -- C function: void mgl_dots_ca (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT c, HCDT a, const char *sch, const char *opt)
     The function draws the arbitrary placed points {X[i], Y[i], Z[i]}. String SCH sets the color scheme and kind of marks. If arrays C, A are specified then they define colors and transparencies of dots. You can use tens plot with style  . to draw non-transparent dots with specified colors. Arrays X, Y, Z, A must have equal sizes. See also crust, tens, mark, plot. dots sample

 -- MGL command: crust xdat ydat zdat ['sch'='']
 -- Method on mglGraph: void Crust (const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *sch="", const char *opt="")
 -- C function: void mgl_crust (HMGL gr, HCDT x, HCDT y, HCDT z, const char *sch, const char *opt)
     The function reconstruct and draws the surface for arbitrary placed points {X[i], Y[i], Z[i]}. String SCH sets the color scheme. If string contain # then wire plot is produced. Arrays X, Y, Z must have equal sizes. See also dots, triplot.

external

Nonlinear fitting
=================

nav

These functions fit data to formula. Fitting goal is to find formula parameters for the best fit the data points, i.e. to minimize the sum \sum_i (f(x_i, y_i, z_i) - a_i)^2/s_i^2. At this, approximation function f can depend only on one argument x (1D case), on two arguments x,y (2D case) and on three arguments x,y,z (3D case). The function f also may depend on parameters. Normally the list of fitted parameters is specified by VAR string (like, abcd). Usually user should supply initial values for fitted parameters by INI variable. But if he/she don't supply it then the zeros are used. Parameter PRINT=true switch on printing the found coefficients to MESSAGE (see Error handling).

Functions Fit() and FitS() do not draw the obtained data themselves. They fill the data FIT by formula f with found coefficients and return it. At this, the x,y,z coordinates are equidistantly distributed in the axis range. Number of points in FIT is defined by option value (default is MGLFITPNTS=100). Note, that this functions use GSL library and do something only if MathGL was compiled with GSL support. Nonlinear fitting hints

 -- MGL command: fits res adat sdat 'func' 'var' [ini=0]
 -- MGL command: fits res xdat adat sdat 'func' 'var' [ini=0]
 -- MGL command: fits res xdat ydat adat sdat 'func' 'var' [ini=0]
 -- MGL command: fits res xdat ydat zdat adat sdat 'func' 'var' [ini=0]
 -- Method on mglGraph: mglData FitS (const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
 -- Method on mglGraph: mglData FitS (const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
 -- Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
 -- Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
 -- Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
 -- Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
 -- Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &s, const char *func, const char *var, const char *opt="")
 -- Method on mglGraph: mglData FitS (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const mglDataA &s, const char *func, const char *var, mglData &ini, const char *opt="")
 -- C function: HMDT mgl_fit_ys (HMGL gr, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
 -- C function: HMDT mgl_fit_xys (HMGL gr, HCDT x, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
 -- C function: HMDT mgl_fit_xyzs (HMGL gr, HCDT x, HCDT y, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
 -- C function: HMDT mgl_fit_xyzas (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, HCDT s, const char *func, const char *var, HMDT ini, const char *opt)
     Fit data along x-, y- and z-directions for array specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]) with weight factor S[i,j,k].

 -- MGL command: fit res adat 'func' 'var' [ini=0]
 -- MGL command: fit res xdat adat 'func' 'var' [ini=0]
 -- MGL command: fit res xdat ydat adat 'func' 'var' [ini=0]
 -- MGL command: fit res xdat ydat zdat adat 'func' 'var' [ini=0]
 -- Method on mglGraph: mglData Fit (const mglDataA &a, const char *func, const char *var, const char *opt="")
 -- Method on mglGraph: mglData Fit (const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
 -- Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &a, const char *func, const char *var, const char *opt="")
 -- Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
 -- Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *func, const char *var, const char *opt="")
 -- Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
 -- Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *func, const char *var, const char *opt="")
 -- Method on mglGraph: mglData Fit (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
 -- C function: HMDT mgl_fit_y (HMGL gr, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
 -- C function: HMDT mgl_fit_xy (HMGL gr, HCDT x, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
 -- C function: HMDT mgl_fit_xyz (HMGL gr, HCDT x, HCDT y, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
 -- C function: HMDT mgl_fit_xyza (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
     Fit data along x-, y- and z-directions for array specified parametrically A[i,j,k](X[i,j,k], Y[i,j,k], Z[i,j,k]) with weight factor 1.

 -- Method on mglGraph: mglData Fit2 (const mglDataA &a, const char *func, const char *var, const char *opt="")
 -- Method on mglGraph: mglData Fit2 (mglData &fit, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
 -- Method on mglGraph: mglData Fit3 (mglData &fit, const mglDataA &a, const char *func, const char *var, const char *opt="")
 -- Method on mglGraph: mglData Fit3 (mglData &fit, const mglDataA &a, const char *func, const char *var, mglData &ini, const char *opt="")
 -- C function: HMDT mgl_fit_2 (HMGL gr, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
 -- C function: HMDT mgl_fit_3 (HMGL gr, HCDT a, const char *func, const char *var, HMDT ini, const char *opt)
     Fit data along all directions for 2d or 3d arrays A with S=1 and X, Y, Z equidistantly distributed in axis range.

 -- MGL command: putsfit x y ['pre'='' 'fnt'='' size=-1]
 -- Method on mglGraph: void PutsFit (mglPoint p, const char *prefix="", const char *font="", mreal size=-1)
 -- C function: void mgl_puts_fit (HMGL gr, mreal x, mreal y, mreal z, const char *prefix, const char *font, mreal size)
     Print last fitted formula with found coefficients (as numbers) at position P0. The string PREFIX will be printed before formula. All other parameters are the same as in Text printing.

 -- Method on mglGraph: const char *GetFit ()
 -- C function only: const char * mgl_get_fit (HMGL gr)
 -- Fortran subroutine: mgl_get_fit (long gr, char *out, int len)
     Get last fitted formula with found coefficients (as numbers).

 -- Method on mglGraph: mreal GetFitChi ()
 -- C function: mreal mgl_get_fit_chi ()
     Get \chi for last fitted formula.

 -- Method on mglGraph: mreal GetFitCovar ()
 -- C function: mreal mgl_get_fit_covar ()
     Get covariance matrix for last fitted formula.

external

Data manipulation
=================

nav

 -- MGL command: hist RES xdat adat
 -- MGL command: hist RES xdat ydat adat
 -- MGL command: hist RES xdat ydat zdat adat
 -- Method on mglGraph: mglData Hist (const mglDataA &x, const mglDataA &a, const char *opt="")
 -- Method on mglGraph: mglData Hist (const mglDataA &x, const mglDataA &y, const mglDataA &a, const char *opt="")
 -- Method on mglGraph: mglData Hist (const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &a, const char *opt="")
 -- C function: HMDT mgl_hist_x (HMGL gr, HCDT x, HCDT a, const char *opt)
 -- C function: HMDT mgl_hist_xy (HMGL gr, HCDT x, HCDT y, HCDT a, const char *opt)
 -- C function: HMDT mgl_hist_xyz (HMGL gr, HCDT x, HCDT y, HCDT z, HCDT a, const char *opt)
     These functions make distribution (histogram) of data. They do not draw the obtained data themselves. These functions can be useful if user have data defined for random points (for example, after PIC simulation) and he want to produce a plot which require regular data (defined on grid(s)). The range for grids is always selected as axis range. Arrays X, Y, Z define the positions (coordinates) of random points. Array A define the data value. Number of points in output array RES  is defined by option value (default is MGLFITPNTS=100).

 -- MGL command: fill dat 'eq'
 -- MGL command: fill dat 'eq' vdat
 -- MGL command: fill dat 'eq' vdat wdat
 -- Method on mglGraph: void Fill (mglData &u, const char *eq, const char *opt="")
 -- Method on mglGraph: void Fill (mglData &u, const char *eq, const mglDataA &v, const char *opt="")
 -- Method on mglGraph: void Fill (mglData &u, const char *eq, const mglDataA &v, const mglDataA &w, const char *opt="")
 -- C function: void mgl_data_fill_eq (HMGL gr, HMDT u, const char *eq, HCDTv, HCDTw, const char *opt)
     Fills the value of array u according to the formula in string EQ. Formula is an arbitrary expression depending  on variables x, y, z, u, v, w. Coordinates x, y, z are supposed to be normalized in axis range. Variable u is the original value of the array. Variables v and w are values of arrays V, W which can be NULL (i.e. can be omitted).

 -- MGL command: datagrid dat xdat ydat zdat
 -- Method on mglGraph: void DataGrid (mglData &u, const mglDataA &x, const mglDataA &y, const mglDataA &z, const char *opt="")
 -- C function: void mgl_data_grid (HMGL gr, HMDT u, HCDT x, HCDT y, HCDT z, const char *opt)
     Fills the value of array u according to the linear interpolation of triangulated surface, found for arbitrary placed points x, y, z. Interpolation is done at points equidistantly distributed in axis range. NAN value is used for grid points placed outside of triangulated surface. Making regular data

 -- MGL command: refill dat xdat vdat [sl=-1]
 -- MGL command: refill dat xdat ydat vdat [sl=-1]
 -- MGL command: refill dat xdat ydat zdat vdat
 -- Method on mglData: void Refill (mglDataA &dat, const mglDataA &x, const mglDataA &v, long sl=-1, const char *opt="")
 -- Method on mglData: void Refill (mglDataA &dat, const mglDataA &x, const mglDataA &y, const mglDataA &v, long sl=-1, const char *opt="")
 -- Method on mglData: void Refill (mglDataA &dat, const mglDataA &x, const mglDataA &y, const mglDataA &z, const mglDataA &v, const char *opt="")
 -- C function: void mgl_data_refill_gr (HMGL gr, HMDT a, HCDT x, HCDT y, HCDT z, HCDT v, long sl, const char *opt)
     Fills by interpolated values of array V at the point {X, Y, Z}={X[i], Y[j], Z[k]} (or {X, Y, Z}={X[i,j,k], Y[i,j,k], Z[i,j,k]} if X, Y, Z are not 1d arrays), where X,Y,Z are equidistantly distributed in axis range and have the same sizes as array DAT. If parameter SL is 0 or positive then changes will be applied only for slice SL.

 -- MGL command: pde RES 'ham' ini_re ini_im [dz=0.1 k0=100]
 -- Method on mglGraph: mglData PDE (const char *ham, const mglDataA &ini_re, const mglDataA &ini_im, mreal dz=0.1, mreal k0=100, const char *opt="")
 -- C function: HMDT mgl_pde_solve (HMGL gr, const char *ham, HCDT ini_re, HCDT ini_im, mreal dz, mreal k0, const char *opt)
     Solves equation du/dz = i*k0*HAM(p,q,x,y,z,|u|)[u], where p=-i/k0*d/dx, q=-i/k0*d/dy are pseudo-differential operators. Parameters INI_RE, INI_IM specify real and imaginary part of initial field distribution. Coordinates x, y, z are supposed to be normalized in axis range. Note, that really this ranges are increased by factor 3/2 for purpose of reducing reflection from boundaries. Parameter DZ set the step along evolutionary coordinate z. At this moment, simplified form of function HAM is supported -- all ``mixed'' terms (like x*p->x*d/dx) are excluded. For example, in 2D case this function is effectively ham = f(p,z) + g(x,z,u). However commutable combinations (like x*q->x*d/dy) are allowed. Here variable u is used for field amplitude |u|. This allow one solve nonlinear problems -- for example, for nonlinear Shrodinger equation you may set ham="p^2 + q^2 - u^2". You may specify imaginary part for wave absorption, like ham = "p^2 + i*x*(x>0)", but only if dependence on variable i is linear (i.e. ham = hre+i*him). PDE solving hints

external