[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MathGL provide the interface to a set of languages via SWIG library. Some of these languages support classes. The typical example is Python – which is denoted in the chapter title.
To use Python classes just execute ‘import mathgl’. The simplest example will be:
import mathgl a=mathgl.mglGraph() a.Box() a.WritePNG('test.png')
Alternatively you can import all classes from mathgl
module and easily access MathGL classes:
from mathgl import * a=mglGraph() a.Box() a.WritePNG('test.png')
It become useful if you will create many mglData
object, for example.
There are 2 classes in Python interface:
mglGraph
– provide practically the same functionality as C++ class mglGraph
(see section MathGL core). But it is not abstract class and it allows one to select at construction stage which plotter (ZB or PS and so on) will be used.
mglData
– is absolutely the same class as C++ mglData
(see section mglData class). But an additional feature to acess data values is added. You can use construction like this: dat[i]=sth;
or sth=dat[i]
at this flat representation of data is used (i.e., i can be in range 0...nx*nx*nz-1.
There is main difference from C++ classes – Python class mglGraph
don't have variables (options). All corresponding features are moved to methods.
The core of MathGL Python class is mglGraph class. It contains a lot of plotting functions for 1D, 2D and 3D plots. So most of sections is describe its methods. Its constructor have following arguments:
mglGraph (int
kind=0
, int
width=600
, int
height=400
)
Create the instance of class mglGraph with specified sizes width and height. Parameter type may have following values: ‘0’ – use mglGraphZB
plotter (default), ‘1’ – use mglGraphPS
plotter, ‘2’ – use mglGraphGL
plotter, ‘3’ – use mglGraphIDTF
plotter.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Functions in this group influences on overall graphics appearance. So all of them should be placed before any actual plotting function calls.
void
DefaultPlotParam ()
Restore initial values for all of parameters except described in Zooming (Python).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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. Variable SetAlphaDef()
specify the default value of alpha-channel. You may switch off transparency of selected plot by variable SetTransparent()
. Finally, variable SetTranspType()
set the kind of transparency. See section Transparent surface sample, for sample code and picture.
void
Alpha (bool
enable)
Sets the transparency on/off. It is recommended to call this function before any plotting command. In any case it must be called before Finish()
function if the last is used. Default value is transparency off. Unfortunately it switches the transparency on/off for all subplots. Use SetTransparent(false)
in particular plot to disable its transparency.
void
SetAlphaDef (float
val)
Sets default value of alpha channel (transparency) for all plotting functions. Note, that OpenGL (mglGraphGL) has incorrect drawing for large values of alpha in case of several overlapping surfaces.
void
SetTransparent (bool
val)
Flag which temporary switches transparency on/off for the plot.
void
SetTranspType (int
type)
This variable set the transparency type. 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.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are several functions for setup lighting. The general function is Light(bool)
which switch on/off the lighting for overall plot. It influence only for graphics which created after Light()
call. 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.
void
Light (bool
enable)
Sets the using of light on/off for overall plot. It is recommended to call this function before any plotting command. Default value is lightning off.
void
Light (int
n, bool
enable)
Switch on/off n-th light source separately.
void
AddLight (int
n, float
x, float
y, float
z, char
c='w'
)
The function adds a light source with identification n at position {x, y, z}. The color of light is defined by character c or by RGB values {r, g, b} (white by default). The brightness of light is br which must be in range [0,1]. Flag infty=true
puts the source to infinite distance (for the faster drawing). It is recommended to call this function before any plotting command.
void
Ambient (float
bright=0.5
)
Sets the brightness of ambient light. The value should be in range [0,1]. It is recommended to call this function before any plotting command.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Fog (float
d, float
dz=0.25
)
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. See section Surface in fog sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions variables control the default (initial) values for most graphics parameters including sizes of markers, arrows, linewidth and so on. As any other settings these ones will influence only on plots created after the settings change.
void
SetBarWidth ( float
val)
Sets relative width of rectangles in Bars plot (see section Bars). Default value is 0.7
.
void
SetMarkSize (float
val)
The size of marks for 1D plotting. Default value is 0.02
.
void
SetArrowSize (float
val)
The size of arrows for 1D plotting, lines and curves (see section Primitives drawing). Default value is 0.03
.
void
SetBaseLineWidth (float
val)
The variable define the base width for all lines. The value <1 is ignored. For values > 1 the real line width is result of multiplication of specified line width and the value of BaseLineWidth. Increase of this variables is actual for large bitmap pictures. Default value is 1
.
void
SetTickLen (float
val, float
stt=1
)
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.
void
SetTickStl (const char *
stl, const char *
sub)
The line style of axis ticks (stl) and subticks (sub). If stl is empty then default style is used (‘k’ or ‘w’ depending on transparency type). If sub is empty then ticks style is used (i.e. stl).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions control the overall zooming of the picture (see Zoom()) or the sub-picture (see PlotFactor). Normally you can use these variables and functions for removing “white” spaces around a plot.
void
SetPlotFactor (float
val)
Sets the factor of plot size. It is not recommended to set it lower then 1.6. This is some anlogue of function Zoom() but applied not to overall image but for each InPlot. Use negative value to enable automatic PlotFactor
selection.
void
Zoom (float
x1, float
y1, float
x2, float
y2)
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. Use Zoom(0,0,1,1)
to return default view.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions set the condition when the points are excluded (cutted) from the drawing.
void
SetCut (bool
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.
void
SetCutBox (float
x1, float
y1, float
z1, float
x2, float
y2, float
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. See section CutMinMax sample, for sample code and picture.
void
CutOff (const char *
EqC)
Function set the cutting off condition by formula EqC. 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 NULL
to disable cutting off condition. See section CutOff sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
SetFontSize (float
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.
void
SetFontDef (char *
fnt)
Sets the font specification (see section Text printing (Python)). Default is “rC” – Roman font centering.
void
SetRotatedText (bool
val)
Sets to use or not text rotation along axis.
void
LoadFont (const char *
name, const char *
path=NULL
)
Load font typeface from path/name.
void
CopyFont (mglGraph *
from)
Copy font data from another mglGraph
object.
void
RestoreFont ()
Restore font data to default typeface.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
SetPalette (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 section 1D plotting) for curves which styles are not specified.
void
SetPalColor (int
n, float
r, float
g, float
b)
Sets color for individual palette entry. Look at mgl_set_palette()
function for simplified palette setting.
void
SetPalNum (int
num)
Sets the number of actual colors in palette. The value must be less then 100.
void
SetScheme (const char *
sch)
Set the color scheme for following plots. Usually this function is used internally. See section Color scheme.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
SetMeshNum (int
val)
Sets approximate number of lines in Mesh(), Fall(), Grid() and also the number of hachures in Vect(), VectC(), Dew() and the number of cells in Cloud*(). By default (=0) it draws all lines/hachures/cells.
void
SetAxialDir (char
val)
Sets direction around which curve rotated in Axial() and Torus(). Default value is 'z'.
void
SetDrawFace (bool
val)
If set to true
then it prevent faces drawing. It is useful for speeding up drawing (for example, during rotation and so on).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These large set of 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 section Cutting), after it transformation formulas are applied, and finally the data was normalized in bounding box.
9.2.1 Ranges (Python) | ||
9.2.2 Transformation (Python) | ||
9.2.3 Ticks (Python) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
SetRanges (float
x1, float
x2, float
y1, float
y2, float
z1=0
, float
z2=0
)
Sets maximal and minimal values for coordinate range (bounding box). If minimal and maximal values of the coordinate are the same then they are ignored. This function also sets Cmin=Min.z
and Cmax=Max.z
. This is default color range for 2d plots.
void
SetCRange (float
min, float
max)
Sets values for color range. This values are used later for determining the color of the surface.
void
XRange (mglData
dat, bool
add=false
)
Sets values of x-range as minimal and maximal values of data a. See also Axis().
void
YRange (mglData
dat, bool
add=false
)
Sets values of y-range as minimal and maximal values of data a. See also Axis().
void
ZRange (mglData
dat, bool
add=false
)
Sets values of z-range as minimal and maximal values of data a. See also Axis().
void
CRange (mglData
dat, bool
add=false
)
Sets values of color range as minimal and maximal values of data a. See also CAxis().
void
SetOrigin (float
x0, float
y0, float
z0)
Sets center of axis cross section. If one of values is NAN then MathGL library try to select optimal axis position.
void
SetAutoRanges (float
x1, float
x2, float
y1=0
, float
y2=0
, float
z1=0
, float
z2=0
)
Sets ranges for automatic variables of plots. Function don't change the direction if minimal and maximal values are the same. For example, if yy1=y2 then ranges along y-direction will not be changed (will be used previous one). Note that the automatic range become axis range after next call of [XYZ]Range() function(s).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
SetFunc (const char *
EqX, const char *
EqY, const char *
EqZ=NULL
)
Sets the transformation formulas for curvilinear coordinate. Each string should contain mathematical expression for real coordinate depending on internal coordinates x, y, z. 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 NULL
. Using transformation formulas will slightly slowing the program, i.e. SetFunc(NULL, NULL, NULL)
is faster than SetFunc("x", "y", "z")
. See section mglFormula class.
void
SetCoor (int
how)
Sets one of the predefined transformation formulas for curvilinear coordinate. Paramater how define the coordinates: mglCartesian=0
– Cartesian coordinates (no transformation); mglPolar=1
– Polar coordiantes x_n=x*cos(y),y_n=x*sin(y), z_n=z; mglSpherical=2
– Sperical coordinates x_n=x*sin(y)*cos(z), y_n=x*sin(y)*sin(z), z_n=x*cos(y); mglParabolic=3
– Parabolic coordinates x_n=x*y, y_n=(x*x-y*y)/2, z_n=z; mglParaboloidal=4
– Paraboloidal coordinates x_n=(x*x-y*y)*cos(z)/2, y_n=(x*x-y*y)*sin(z)/2, z_n=x*y; mglOblate=5
– Oblate coordinates x_n=cosh(x)*cos(y)*cos(z), y_n=cosh(x)*cos(y)*sin(z), z_n=sinh(x)*sin(y); mglProlate=6
– Prolate coordinates x_n=sinh(x)*sin(y)*cos(z), y_n=sinh(x)*sin(y)*sin(z), z_n=cosh(x)*cos(y); mglElliptic=7
– Elliptic coordinates x_n=cosh(x)*cos(y), y_n=sinh(x)*sin(y), z_n=z; mglToroidal=8
– Toroidal coordinates x_n=sinh(x)*cos(z)/(cosh(x)-cos(y)), y_n=sinh(x)*sin(z)/(cosh(x)-cos(y)), z_n=sin(y)/(cosh(x)-cos(y)); mglBispherical=9
– Bispherical coordinates x_n=sin(y)*cos(z)/(cosh(x)-cos(y)), y_n=sin(y)*sin(z)/(cosh(x)-cos(y)), z_n=sinh(x)/(cosh(x)-cos(y)); mglBipolar=10
– Bipolar coordinates x_n=sinh(x)/(cosh(x)-cos(y)), y_n=sin(y)/(cosh(x)-cos(y)), z_n=z.
void
Ternary (bool
tern)
The function sets to draws Ternary plot. This special plot is 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. See section Ternary plot sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
AdjustTicks (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 TuneTicks=true
.
void
SetTicks (char
dir, float
d=-5
, int
ns=0
, float
org=NAN
)
Set the ticks step d, number of sub-ticks ns and initial ticks position org for the axis along direction dir. Variable d set step for axis ticks (if positive) or it's number on the axis range (if negative). Zero value set logarithmic ticks. If org value is NAN then value from Org is used.
void
SetTicksVal (char
dir, int
n, float *
val, char **
lbl)
void
SetTicksVal (char
dir, int
n, float *
val, wchar_t **
lbl)
Set the manual positions val and its labels lbl for n-th ticks along axis dir. The arrays val and lbl have to contain n elements. Use SetTicks()
to restore automatic ticks.
void
SetTickTemplX (const char *
xtt)
void
SetTickTemplY (const char *
ytt)
void
SetTickTemplZ (const char *
ztt)
void
SetTickTemplC (const char *
ctt)
void
SetTickTemplX (const wchar_t *
xtt)
void
SetTickTemplY (const wchar_t *
ytt)
void
SetTickTemplZ (const wchar_t *
ztt)
void
SetTickTemplC (const wchar_t *
ctt)
void
SetXTT (const char *
xtt)
void
SetYTT (const char *
ytt)
void
SetZTT (const char *
ztt)
void
SetCTT (const char *
ctt)
void
SetXTT (const wchar_t *
xtt)
void
SetYTT (const wchar_t *
ytt)
void
SetZTT (const wchar_t *
ztt)
void
SetCTT (const wchar_t *
ctt)
The template for x-,y-,z-axis ticks or colorbar ticks. It may contain TeX symbols also. If xtt, ytt, ztt, ctt=NULL
then default template is used (in simplest case it is ‘%.2g’) with automatic detaching of common multiplier or common component (see TuneTicks).
void
SetTuneTicks (bool
tune, float
factor_pos=1.15
)
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) or common component (for narrow range, like from 0.999 to 1.000). Also set the position of common multiplier/component on the axis: =0 at minimal axis value, =1 at maximal axis value. Default value is 1.15.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions control how and where further plotting will be placed. There is a curtain order of calling of these functions for the better plot view. First one should be SubPlot() or InPlot() for specifying the place. After it a Rotate() and Aspect(). And finally any other plotting functions may be called. Alternatevely you can use ColumnPlot() for position plots in the column one by another without gap between plot axis (bounding boxes).
void
SubPlot (int
nx, int
ny, int
m, float
dx=0
, float
dy=0
)
Puts further plotting in a m-th cell of nx*ny grid of the whole frame area. This function set off any aspects or rotations. So it should be used first for creating the subplot. From the aesthetical point of view it is not recommended to use this function with different matrices in the same frame. The position of the cell can be shifted from its default position by relative size dx, dy.
void
InPlot (float
x1, float
x2, float
y1, float
y2, bool
rel=false
)
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 last InPlot() with rel=false
) is used. This function set off any aspects or rotations. So it should be used first for creating subplot.
void
ColumnPlot (int
num, int
ind)
Puts further plotting in ind-th cell of column with num cells. The position is relative to previous SubPlot() call (or InPlot() with rel=false
).
void
Rotate (float
TetX, float
TetZ, float
TetY=0
)
Rotates a further plotting relative to each axis (x, z, y) consecutively on angles TetX, TetZ, TetY.
void
RotateN (float
Tet, float
x, float
y, float
z)
Rotates a further plotting around vector {x,y,z}.
void
Aspect (float
Ax, float
Ay, float
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.
void
Perspective (float
a)
Add (switch on) the perspective to plot. The parameter a ~ 1/z_{eff} \in [0,1). By default (a=0
) the perspective is off.
void
Identity ()
Clears transformation matrix. This function clears all previous effects of Aspect(), SubPlot(), InPlot() or Rotate() functions. It is equivalent to the call of InPlot(0,1,0,1)
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 and SVG files.
void
WriteFrame (const char *
fname=NULL
, const char *
descr=NULL
)
Exports current frame to a file fname which type is determined by the extension. Parameter descr adds description to file (can be NULL
). If fname=NULL
then the file ‘frame####.jpg’ is used, where ‘####’ is current frame id.
void
WritePNG (const char *
fname, const char *
descr=NULL
)
Exports current frame to PNG file with transparent background. Parameter fname specifies the file name, descr adds description to file. By default there are no description added. This function does nothing if NO_PNG is defined during compilation of MathGL library.
void
WritePNGSolid (const char *
fname, const char *
descr=NULL
)
Exports current frame to PNG file with non-transparent background (usually white). Parameter fname specifies the file name, descr adds description to file. By default there are no description added. This function does nothing if NO_PNG is defined during compilation of MathGL library.
void
WriteJPEG (const char *
fname, const char *
descr=NULL
)
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 NO_JPEG is defined during compilation of MathGL library.
void
WriteGIF (const char *
fname, const char *
descr=NULL
)
Exports current frame to GIF file. Parameter fname specifies the file name, descr adds description to file. By default there is no description added.
void
WriteBMP (const char *
fname, const char *
descr=NULL
)
Exports current frame to BMP file. Parameter fname specifies the file name, descr adds description to file. There is no compression used.
void
WriteEPS (const char *
fname, const char *
descr=NULL
)
Exports current frame to EPS file. The vector representation is used if possible. 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.
void
WriteSVG (const char *
fname, const char *
descr=NULL
)
Exports current frame to SVG (Scalable Vector Graphics) file. The vector representation is used. In difference of EPS format, SVG format support transparency that allows to correctly draw half-transparent plot (like SurfA(), Surf3A(), CloudQ() or CloudP()). 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).
void
WriteIDTF (const char *
fname, const char *
descr=NULL
)
Exports current frame to IDTF file. Later this file can be converted to U3D format. The vector representation is used. So, the output file may be too large for graphic of large data array (especially for surfaces). 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).
void
ShowImage (const char *
viewer="kuickshow"
, bool
nowait=False
)
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).
void
SetSize (int
width, int
height)
Sets size of picture in pixels. This function must be called before any other plotting because it completely remove picture contents.
void
Flush ()
Flushes the plotting commands to frame. This function may be useful if one wants to remove array before the finishing of the plot (i.e. before calling Finish()
). Also call of this function separate the objects in mglGraphIDTF. Most of plots call this function internally.
int
GetWidth ()
int
GetHeight ()
Gets width or height of the image.
void
GetRGB (char *
buf, int
size)
Gets RGB bitmap of the current state of the image to the buffer buf of size size. Function do nothing if size<3*Width*Height. 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].
void
GetRGBA (char *
buf, int
size)
Gets RGBA bitmap of the current state of the image to the buffer buf of size size. Function do nothing if size<4*Width*Height. 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].
void
GetBGRN (char *
buf, int
size)
Gets RGB bitmap of the current state of the image to the buffer buf of size size. Function do nothing if size<4*Width*Height. Format of each element of bits is: {blue, green, red, 255}. Number of elements is Width*Height. Position of element {i,j} is [4*i + 4*Width*j]. This format is useful for some widget libraries like Qt.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw some simple objects like line, point, sphere, drop, cone and so on.
void
Clf (float
r=1
, float
g=1
, float
b=1
)
Clear the picture and will it by color {r,g,b}.
void
Ball (float
x, float
y, float
z, char *
col="r"
)
Draws a point (ball) at position p with color col.
void
Line (float
x1, float
y1, float
z1, float
x2, float
y2, float
z2, char *
stl="B"
, int
num=2
)
Draws a geodesic line (straight line in Cartesian coordinates) from point {x1,y1,z1} to {x2,y2,z2} 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 section Transformation (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).
void
Curve (float
x1, float
y1, float
z1, float
dx1, float
dy1, float
dz1, float
x2, float
y2, float
z2, float
dx2, float
dy2, float
dz2, const char *
stl="B"
, int
num=100
)
Draws Bezier-like curve from point {x1,y1,z1} to {x2,y2,z2} using line style stl. At this tangent is co-directed with {dx1,dy1,dz1}, {dx2,dy2,dz2} 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 section Transformation (curved coordinates)). Contrary, for large values (for example, =100
) the spline like Bezier curve will be drawn in corresponding coordinate system.
void
Face (mglPoint
p1, mglPoint
p2, mglPoint
p3, mglPoint
p4, const char *
stl="w"
, int
num=2
)
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.
void
FaceX (float
x0, float
y0, float
z0, float
wy, float
wz, const char *
stl="w"
, float
dx=0
, float
dy=0
)
void
FaceY (float
x0, float
y0, float
z0, float
wx, float
wz, const char *
stl="w"
, float
dx=0
, float
dy=0
)
void
FaceZ (float
x0, float
y0, float
z0, float
wx, float
wy, const char *
stl="w"
, float
dx=0
, float
dy=0
)
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 different if all 4 colors are specified for each vertex. Parameters d1!=0, d2!=0 set additional shift of the last vertex (i.e. to draw quadrangle).
void
Sphere (float
x0, float
y0, float
z0, float
r, const char *
stl="r"
)
Draw the sphere with radius r and center at point {x0, y0, z0} and color stl.
void
Drop (float
x0, float
y0, float
z0, float
dx, float
dy, float
dz, float
r, const char *
col="r", float
shift=1
, float
ap=1
)
Draw the drop with radius r at point p elongated in direction q 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). See section Drops sample, for sample code and picture.
void
Cone (float
x1, float
y1, float
z1, float
x2, float
y2, float
z2, float
r1, float
r2=-1
, const char *
stl="B"
, bool
edge=false
)
Draw tube (or truncated cone if edge=false
) between points {x1,y1,z1}, {x2,y2,z2} with radius at the edges r1, r2. If r2<0 then it is suppsosed that r2=r1. The cone color is defined by string stl.
void
Mark (float
x, float
y, float
z, char
mark)
Draws a marks of different type at position {x,y,z}.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw the text. There are functions for drawing text in arbitrary place, in arbitrary direction and along arbitrary curve. The class mglFont (see section mglFont class) is used for low-level string parsing and printing. It can use arbitrary font-faces and parse many TeX commands. All these functions have 2 variant: for printing 8-bit text (char *
) and for printing Unicode text (wchar_t *
). In first case the conversion in 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 FontSize. The font type (STIX, arial, courier, times and so on) can be selected by function LoadFont(). See section Font settings (Python).
The font parameters are described by string. This string may contain several characters of font type (‘rbiwou’) and/or align (‘LRC’) specification. Also it may contain the text color ‘wkrgbcymhRGBCYMHW’ (see section mglColor class) after symbol ‘:’. The font types are: ‘r’ – roman 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. Also a parsing of the LaTeX-like syntax is provided (for detail see section mglFont class). For example, string ‘iC:b’ correspond to italic font style for centered text which printed by blue color.
void
Puts (float
x, float
y, float
z, const char *
text, const char *
font=NULL
, float
size=-1
, char
dir=0
)
void
Putsw (float
x, float
y, float
z, const wchar_t *
text, const char *
font=NULL
, float
size=-1
, char
dir=0
)
The function plots the string text at position {x,y,z} with fonts specifying by the criteria how. The size of font is set by size parameter (default is FontSize). Parameter dir specifies the additional string align. The aligns are: ‘x’ – align as x-label, ‘y’ – align as y-label, ‘z’ – align as z-label, ‘i’ – align as x-label but inverse writing direction, ‘t’ – no align (default), ‘n’ – align in x-y plane.
void
Puts (float
x, float
y, float
z, float
dx, float
dy, float
dz, const char *
text, char
where='t'
, float
size=-1
)
void
Putsw (float
x, float
y, float
z, float
dx, float
dy, float
dz, const wchar_t *
text, char
where='t'
, float
size=-1
)
The function plots the string text at position {x,y,z} along direction {dx,dy,dz} with specified size.
void
Title (const char *
text, const char *
font=0
, int
size=-2
)
void
Title (const wchar_t *
text, const char *
font=0
, int
size=-2
)
Print string text as title of the picture (at the top of the picture). Can be used at any place (even inside SubPlot()).
void
Text (mglData
y, const char *
text, const char *
font=NULL
, float size=-1
)
void
Text (mglData
y, const wchar_t *
text, const char *
font=NULL
, float size=-1
)
void
Text (mglData
x, mglData
y, const char *
text, const char *
font=NULL
, float size=-1
)
void
Text (mglData
x, mglData
y, const wchar_t *
text, const char *
font=NULL
, float size=-1
)
void
Text (mglData
x, mglData
y, mglData
z, const char *
text, const char *
font=NULL
, float size=-1
)
void
Text (mglData
x, mglData
y, mglData
z, const wchar_t *
text, const char *
font=NULL
, float size=-1
)
The function draws text along the curve between points {x[i], y[i], z[i]} by font style font and with size size. The string font may contain symbols ‘t’ for printing the text under the curve (default), or ‘T’ for printing the text above 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 interval [Min.x, Max.x] (see section Ranges (bounding box)). See section Text sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 section Axis settings (Python).
void
Axis (const char *
dir="xyz"
, bool
adjust=false
)
Draws axes with ticks (see section Axis settings) in directions determined by string parameter dir.If string contain the symbol ‘_’ then tick labels are not printed. Font for ticks labels is determined by FontDef (see section Font settings (Python)). Ticks will be adjusted if adjust=true
(by call of AdjustTicks()
).
void
Colorbar (const char *
sch=NULL
, int
where=0
)
Draws colorbar with color scheme sch (current scheme if sch=NULL
) at edge of plot. Parameter where specifies the position of colorbar: ‘0’ - at right (default), ‘1’ - at left, ‘2’ - at top, ‘3’ - at bottom. See section Dens sample, for sample code and picture.
void
Colorbar (const char *
sch, int
where, float
x, float
y, float
w, float
h)
void
Colorbar (int
where, float
x, float
y, float
w, float
h)
Draws colorbar with color scheme sch (current scheme if not specified) at arbitrary position of subplot {x, y} (supposed to be in range [0,1]). Parameter where specifies the position of colorbar labels: ‘0’ - at left, ‘1’ - at right, ‘2’ - at bottom, ‘3’ - at top. Parameters w, h set the relative width and height of the colorbar.
void
Colorbar (mglData
v, const char *
sch=NULL
, int
where=0
)
Draws colorbar with sharp colors sch (current palette if sch=NULL
) for values v at edge of plot. Parameter where specifies the position of colorbar: ‘0’ - at right (default), ‘1’ - at left, ‘2’ - at top, ‘3’ - at bottom. See section Dens sample, for sample code and picture.
void
Grid (const char *
dir="xyz"
, const char *
pen="B-"
)
Draws grid lines perpendicular to direction determined by string parameter dir. The step of grid lines is the same as tick step for an Axis(). The style of lines is determined by pen parameter (default value is dark blue solid line (‘B-’).
void
Box (const char *
col, bool
ticks=true
)
Draws bounding box outside the plotting volume with color col.
void
Label (char
dir, const char *
text, int
pos=+1
, float
size=-1.4
, float
shift=0
)
Prints the label text for axis dir=‘x’,‘y’,‘z’,‘t’ (here ‘t’ is “ternary” axis t=1-x-y). 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. Parameter size determines the font size for the label. By default the font size is 1.4 times larger than the one for ticks FontSize (see section Font settings (Python)). See section Text printing.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 LaTeX parsing). The array of string 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. Parameters font and size specify the font style and size (see section Font settings (Python)). Parameter llen 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. See section Legend sample, for sample code and picture.
void
Legend (int
where=0x3
, const char *
font="rL"
, float
size=-0.8
, float
llen=0.1
)
Draws legend of accumulated legend entries by font font with size. Parameter where 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).
void
Legend (float
x, float
y, const char *
font="rL"
, float
size=-0.8
, float
llen=0.1
)
Draws legend of accumulated legend entries by font font with size. Position of legend is determined by parameter x, y which supposed to be normalized to interval [0,1].
void
AddLegend (const char *
text, const char *
style)
void
AddLegend (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 section Line styles). Maximal number of entries is 100.
void
ClearLegend ()
Clears saved legend strings.
void
SetLegendBox (bool
enable)
Switch on/off drawing box near legend. By default (=true
) box is drawn.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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. There are 5 generally different types of data representations: simple line plot (Plot), line plot with filling under it (Area), stairs plot (Step), bar plot (Bars, Barh) and vertical lines (Stem). Each type of plotting has similar interface. There are 3D version and two 2D versions. One of last requires single array. The parameters of line and marks are specified by the string argument. If the string parameter is NULL then solid line with color from palette Pal is used (see section Pallete and colors (Python)). Also there are some special 1d plots having slightly different interface: surface of curve rotation (Torus), chart (Chart) and error boxes (Error), marks with variable size (Mark), tubes (Tube) and so on. See section Line styles.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw continuous lines between points. 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 section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Area, Step, Stem, Tube, Mark, Error, Belt, Tens. See section Plot sample, for sample code and picture.
void
Plot (mglData
x, mglData
y, mglData
z, const char *
pen=NULL
)
The function draws continuous lines between points {x[i], y[i], z[i]} in 3D space.
void
Plot (mglData
x, mglData
y, const char *
pen=NULL
)
The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z.
void
Plot (mglData
y, const char *
pen=NULL
)
The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Plot (mglData
a, const char *
pen=NULL
, float
r=-1
)
This functions draws radar chart which is continuous lines between points located on an radial lines (like plot in Polar coordinates). The plots are drawn for each row if one of the data is the matrix. Parameter r set the additional shift of data (i.e. the data a+r is used instead of a). If r<0
then r=max(0, -min(a)
. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). If pen containt ‘#’ symbol then "grid" (radial lines and circle for r) is drawn See also Plot. See section Radar sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw continuous lines between points with color defined by the special array (look like tension plot). 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 scheme (see section Color scheme) and style and/or width of line (see section Line styles). By default (pen=NULL
) solid line with current color scheme is used. See also Plot, Mesh, Fall. See section Tens sample, for sample code and picture.
void
Tens (mglData
x, mglData
y, mglData
z, mglData
c, const char *
pen=NULL
)
The function draws continuous lines between points {x[i], y[i], z[i]} in 3D space with color defined by c[i].
void
Tens (mglData
x, mglData
y, mglData
c, const char *
pen=NULL
)
The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z with color defined by c[i].
void
Tens (mglData
y, mglData
c, const char *
pen=NULL
)
The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z with color defined by c[i], where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw continuous lines between points and fills it to axis plane. 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 section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Plot, Bars, Stem. See section Area sample, for sample code and picture.
void
Area (mglData
x, mglData
y, mglData
z, const char *
pen=NULL
)
The function draws continuous lines between points {x[i], y[i], z[i]} in 3D space and fills it down to z = Org.z.
void
Area (mglData
x, mglData
y, const char *
pen=NULL
)
The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z and fills it down to y = Org.y.
void
Area (mglData
y, const char *
pen=NULL
)
The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z and fills it down to y = Org.y, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
void
AreaSum (mglData
x, mglData
y, const char *
pen=NULL
)
The function draws continuous lines between points {x[i], y[i]} in plane z=Min.z and fills it down to y = Org.y. The lines are drawn one abover another (like summation). Note, you can reach the same effect if call y.CumSum("y");
before Area
plot.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions fill area between 2 curves. 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=y1.nx=y2.nx and all dimensions of arrays y1 and y2 must be equal too. String pen specifies the color (see section Line styles). By default (pen=NULL
) color from palette is used (see section Pallete and colors (Python)). See also Area, Bars, Stem. See section Region sample, for sample code and picture.
void
Region (mglData
x, mglData
y1, mglData
y2, const char *
pen=NULL
, bool
inside=true
)
The function fills area between curves {x[i], y[i]} and {x[i], y2[i]}.
void
Region (mglData
y1, mglData
y2, const char *
pen=NULL
, bool
inside=true
)
The function fills area between curves {x[i], y[i]} and {x[i], y2[i]}, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw vertical bars from points to axis plane. 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 section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Barh, Area, Stem, Chart, Default sizes. See section Bars sample, for sample code and picture.
void
Bars (mglData
x, mglData
y, mglData
z, const char *
pen=NULL
)
The function draws vertical bars from points {x[i], y[i], z[i]} down to z = Org.z.
void
Bars (mglData
x, mglData
y, const char *
pen=NULL
)
The function draws vertical bars from points {x[i], y[i]} down to y = Org.y in plane z=Min.z.
void
Bars (mglData
y, const char *
pen=NULL
)
The function draws vertical bars from points {x[i], y[i]} down to y = Org.y in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw horizontal bars from points to axis plane. 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 section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Barh, Default sizes. See section Barh sample, for sample code and picture.
void
Barh (mglData
y, mglData
v, const char *
pen=NULL
)
The function draws horizontal bars from points {v[i], y[i]} down to x = Org.x in plane z=Min.z.
void
Barh (mglData
v, const char *
pen=NULL
)
The function draws horizontal bars from points {v[i], y[i]} down to x = Org.x in plane z=Min.z, where y[i] values are equidistantly distributed in interval [Min.y, Max.y].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw vertical lines from points to axis plane. 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 section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Area, Bars, Plot. See section Stem sample, for sample code and picture.
void
Stem (mglData
x, mglData
y, mglData
z, const char *
pen=NULL
)
The function draws vertical lines from points {x[i], y[i], z[i]} down to z = Org.z.
void
Stem (mglData
x, mglData
y, const char *
pen=NULL
)
The function draws vertical lines from points {x[i], y[i]} down to y = Org.y in plane z=Min.z.
void
Stem (mglData
y, const char *
pen=NULL
)
The function draws vertical lines from points {x[i], y[i]} down to y = Org.y in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw continuous stairs for points to axis plane. 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 section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Plot, Stem, Tile, Boxs. See section Step sample, for sample code and picture.
void
Step (mglData
x, mglData
y, mglData
z, const char *
pen=NULL
)
The function draws continuous stairs for points {x[i], y[i], z[i]}.
void
Step (mglData
x, mglData
y, const char *
pen=NULL
)
The function draws continuous stairs for points {x[i], y[i]} in plane z=Min.z.
void
Step (mglData
y, const char *
pen=NULL
)
The function draws continuous stairs for points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw surface which is result of curve {r, z} rotation around AxialDir axis (see section Other settings). The sizes of 1st dimension must be equal for all arrays r.nx=z.nx. String pen specifies the color (see section Line styles). By default (pen=NULL
) color from palette is used (see section Pallete and colors). See also Plot, Axial. See section Torus sample, for sample code and picture.
void
Torus (mglData
r, mglData
z, const char *
pen=NULL
)
The function draws surface which is result of curve {r[i], z[i]} rotation.
void
Torus (mglData
z, const char *
pen=NULL
)
The function draws surface which is result of curve {r[i], z[i]} rotation, where r[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Chart (mglData
a, const char *
col=NULL
)
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 section Pallete and colors). Spaces in colors denote transparent “color”, i.e. if col contain space(s) then 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). See section Chart sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw marks with size r*MarkSize (see section Default sizes) at points {x[i], y[i], z[i]}. 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=r.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). If you need to draw markers of the same size then you may use Plot function. See also Plot, TextMark, Stem, Error. See section Mark sample, for sample code and picture.
void
Mark (mglData
x, mglData
y, mglData
z, mglData
r, const char *
pen=NULL
)
The function draws marks for points {x[i], y[i], z[i]} in 3D space.
void
Mark (mglData
x, mglData
y, mglData
r, const char *
pen=NULL
)
The function draws marks for points {x[i], y[i]} in plane z=Min.z.
void
Mark (mglData
y, mglData
r, const char *
pen=NULL
)
The function draws marks for points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw string text as marks with size proportional to r*MarkSize (see section Default sizes) at points {x[i], y[i], z[i]}. 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=r.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Plot, Mark, Stem. See section TextMark sample, for sample code and picture.
void
TextMark (mglData
x, mglData
y, mglData
z, mglData
r, const wchar_t *
text, const char *
fnt=NULL
)
void
TextMark (mglData
x, mglData
y, mglData
z, mglData
r, const char *
text, const char *
fnt=NULL
)
The function draws textual marks for points {x[i], y[i], z[i]} in 3D space.
void
TextMark (mglData
x, mglData
y, mglData
r, const wchar_t *
text, const char *
fnt=NULL
)
void
TextMark (mglData
x, mglData
y, mglData
r, const char *
text, const char *
fnt=NULL
)
The function draws textual marks for points {x[i], y[i]} in plane z=Min.z.
void
TextMark (mglData
y, mglData
r, const wchar_t *
text, const char *
fnt=NULL
)
void
TextMark (mglData
y, mglData
r, const char *
text, const char *
fnt=NULL
)
The function draws textual marks for points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
void
TextMark (mglData
y, const wchar_t *
text, const char *
fnt=NULL
)
void
TextMark (mglData
y, const char *
text, const char *
fnt=NULL
)
The function draws textual marks for points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x]. The mark sizes r[i]=1 for all points.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw error boxes at points {x[i], y[i]} on plane z = Min.z. This can be useful, for example, in experimental points, or to show numeric error or some estimations and so on. 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=r.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Plot. See section Error sample, for sample code and picture.
void
Error (mglData
x, mglData
y, mglData
ex, mglData
ey, const char *
pen=NULL
)
Draws a error box {ex, ey} in point position {x, y}.
void
Error (mglData
x, mglData
y, mglData
ey, const wchar_t *
pen=NULL
)
Draws a error box ey (along only one direction) in point position {x, y}.
void
Error (mglData
y, mglData
ey, const char *
pen=NULL
)
Draws a error box ey (along only one direction) in point position {x, y}, where x values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions draw the tube with variable radius r[i] along the curve between points {x[i], y[i], z[i]}. 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=r.nx. String pen specifies the color and style of line and marks (see section Line styles). By default (pen=NULL
) solid line with color from palette is used (see section Pallete and colors). See also Plot. See section Tube sample, for sample code and picture.
void
Tube (mglData
x, mglData
y, mglData
z, mglData
r, const char *
pen=NULL
)
void
Tube (mglData
x, mglData
y, mglData
z, float
r, const char *
pen=NULL
)
The function draws tube with radius r between points {x[i], y[i], z[i]} in 3D space.
void
Tube (mglData
x, mglData
y, mglData
r, const char *
pen=NULL
)
void
Tube (mglData
x, mglData
y, float
r, const char *
pen=NULL
)
The function draws tube with radius r between points {x[i], y[i]} in plane z=Min.z.
void
Tube (mglData
y, mglData
r, const char *
pen=NULL
)
void
Tube (mglData
y, float
r, const char *
pen=NULL
)
The function draws tube with radius r between points {x[i], y[i]} in plane z=Min.z, where x[i] values are equidistantly distributed in interval [Min.x, Max.x].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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. There are 6 generally different types of data representations: simple mesh lines plot (Mesh), surface plot (Surf), surface plot by boxes (Boxs), surface plot by tiles (Tile), waterfall-like plot (Fall), belt plot (Belt), density plot (Dens), contour lines plot (Cont), solid contours plot (ContF) and its rotational figure (Axial). Cont, ContF and Axial functions have variants for automatic and manual selection of level values for contours. Also there are functions for plotting data grid lines according to the data format (Grid) for enhancing density or contour plots. 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 section Color scheme.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Mesh (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
)
The function draws mesh lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. String sch sets the color scheme. Previous color scheme is used by default. 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). Mesh lines are plotted for each z slice of the data. See also Surf, Fall, NeshNum (see section Other settings), Cont, Tens. See section Mesh sample, for sample code and picture.
void
Mesh (mglData
z, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Fall (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
)
The function draws fall lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. String sch sets the color scheme. Previous color scheme is used by default. If sch contain ‘x’ then lines are drawn along x-direction else (by default) lines are drawn along y-direction. 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). Fall lines are plotted for each z slice of the data. See also Belt, Mesh, Tens, NeshNum (see section Other settings). See section Fall sample, for sample code and picture.
void
Fall (mglData
z, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Belt (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
)
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 (see section Plot). String sch sets the color scheme. Previous color scheme is used by default. If sch contain ‘x’ then belts are drawn along x-direction else (by default) belts are drawn along y-direction. 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). Belts are plotted for each z slice of the data. See also Fall, Surf, Plot, NeshNum (see section Other settings). See section Belt sample, for sample code and picture.
void
Belt (mglData
z, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Surf (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
)
The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]}. String sch sets the color scheme. Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. 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). Surface is plotted for each z slice of the data. See also Mesh, Dens, Belt, Tile, Boxs, SurfC, SurfA. See section Surf sample, for sample code and picture.
void
Surf (mglData
z, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Boxs (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
)
The function draws vertical boxes for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. String sch sets the color scheme. Previous color scheme is used by default. 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). Surface is plotted for each z slice of the data. See also Surf, Tile, Step. See section Boxs sample, for sample code and picture.
void
Boxs (mglData
z, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Tile (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
)
The function draws horizontal tiles for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. Such plot can be used as 3d generalization of Step (see section Step). String sch sets the color scheme. Previous color scheme is used by default. 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). Surface is plotted for each z slice of the data. See also Surf, Boxs, Step, TileS. See section Tile sample, for sample code and picture.
void
Tile (mglData
z, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Dens (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
, float
zVal=NAN
)
The function draws density plot for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z = zVal. String sch sets the color scheme. Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. 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). Surface is plotted for each z slice of the data. See also Surf, Cont, ContF, DensXYZ. See section Dens sample, for sample code and picture.
void
Dens (mglData
z, const char *
sch=NULL
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Cont (mglData
v, mglData
x, mglData
y, mglData
z, const char *
sch=NULL
, float
zVal=NAN
)
The function draws contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z = zVal (or for z=v[k] if zVal==NAN
). Contours are plotted for z[i,j]=v[k] where v[k] are values of data array v. String sch sets the color scheme. Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. 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). Surface is plotted for each z slice of the data. See also Dens, ContF, Axial, ContXYZ. See section Cont sample, for sample code and picture.
void
Cont (mglData
v, mglData
z, const char *
sch=NULL
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
Cont (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
, int
num=7
, float
zVal=NAN
)
The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
Cont (mglData
z, const char *
sch=NULL
, int
num=7
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
ContF (mglData
v, mglData
x, mglData
y, mglData
z, const char *
sch=NULL
, float
zVal=NAN
)
The function draws solid (or filled) contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z = zVal (or for z=v[k] if zVal==NAN
). 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 color scheme. Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. 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). Surface is plotted for each z slice of the data. See also Dens, Cont, ContD, Axial, ContFXYZ. See section ContF sample, for sample code and picture.
void
ContF (mglData
v, mglData
z, const char *
sch=NULL
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
ContF (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
, int
num=7
, float
zVal=NAN
)
The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
ContF (mglData
z, const char *
sch=NULL
, int
num=7
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
ContD (mglData
v, mglData
x, mglData
y, mglData
z, const char *
sch=NULL
, float
zVal=NAN
)
The function draws solid (or filled) contour lines for surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z = zVal (or for z=v[k] if zVal==NAN
) 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)]
. 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). Surface is plotted for each z slice of the data. See also Dens, Cont, ContF. See section ContD sample, for sample code and picture.
void
ContD (mglData
v, mglData
z, const char *
sch=NULL
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
ContD (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
, int
num=7
, float
zVal=NAN
)
The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
ContD (mglData
z, const char *
sch=NULL
, int
num=7
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Axial (mglData
v, mglData
x, mglData
y, mglData
z, const char *
sch=NULL
)
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. String sch sets the color scheme. Previous color scheme is used by default. If string sch have symbol ‘#’ then wire plot is produced. If string contain symbols ‘x’, ‘y’ or ‘z’ then rotation axis AxialDir (see section Other settings) will be set to specified direction. 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). Surface is plotted for each z slice of the data. See also Cont, ContF, Torus, Surf3. See section Axial sample, for sample code and picture.
void
Axial (mglData
v, mglData
z, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
Axial (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
, int
num=3
)
The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
Axial (mglData
z, const char *
sch=NULL
, int
num=3
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Grid (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
, float
zVal=NAN
)
The function draws grid lines for density plot of surface specified parametrically {x[i,j], y[i,j], z[i,j]} at z = zVal. String sch sets the color scheme. Previous color scheme is used by default. 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). Grid is plotted for each z slice of the data. See also Dens, Cont, ContF.
void
Grid (mglData
z, const char *
sch=NULL
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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. There are 4 generally different types of data representations: isosurface or surface of constant value (Surf3), density plot at slices (Dens3), contour lines plot at slices (Cont3), solid contours plot at slices (ContF3) and cloud-like plot (Cloud). Surf3, Cont3 and ContF3 functions have variants for automatic and manual selection of level values for surfaces/contours. Also there are functions for plotting data grid lines according to the data format (Grid3) for enhancing density or contour plots. 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 section Color scheme.
9.11.1 Surf3 (Python) | ||
9.11.2 Dens3 (Python) | ||
9.11.3 Cont3 (Python) | ||
9.11.4 ContF3 (Python) | ||
9.11.5 Grid3 (Python) | ||
9.11.6 Cloud (Python) | ||
9.11.7 Beam (Python) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Surf3 (float
val, mglData
x, mglData
y, mglData
z, mglData
a, const char *
stl=NULL
)
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. String sch sets the color scheme. Previous color scheme is used by default. If string contain ‘#’ then wire plot is produced. Arrays x, y, z can be vectors (not 3d arrays as a). 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. See section Surf3 sample, for sample code and picture.
void
Surf3 (float
val, mglData
a, const char *
sch=NULL
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
Surf3 (mglData
x, mglData
y, mglData
z, mglData
a, const char *
stl=NULL
, int
num=3
)
Draws num-th uniformly distributed in range [Cmin, Cmax] isosurfaces for 3d data specified parametrically.
void
Surf3 (mglData
a, const char *
sch=NULL
, int
num=3
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Dens3 (mglData
x, mglData
y, mglData
z, mglData
a, char
dir, int
sVal=-1
, const char *
stl=NULL
)
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 dir={‘x’, ‘y’, ‘z’} direction. String sch sets the color scheme. Previous color scheme is used by default. If string stl have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). See also Cont3, ContF3, Dens, Grid3. See section Dens3 sample, for sample code and picture.
void
Dens3 (mglData
a, char
dir, int
sVal=-1
, const char *
sch=NULL
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
DensA (mglData
x, mglData
y, mglData
z, mglData
a, const char *
stl=NULL
)
Draws density plots at all central slices of the 3d data specified parametrically.
void
DensA (mglData
a, const char *
sch=NULL
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Cont3 (mglData
v, mglData
x, mglData
y, mglData
z, mglData
a, char
dir, int
sVal=-1
, const char *
stl=NULL
)
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 dir={‘x’, ‘y’, ‘z’} direction. String sch sets the color scheme. Previous color scheme is used by default. If string stl have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). See also Dens3, ContF3, Cont, Grid3. See section Cont3 sample, for sample code and picture.
void
Cont3 (mglData
v, mglData
a, char
dir, int
sVal=-1
, const char *
sch=NULL
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
Cont3 (mglData
x, mglData
y, mglData
z, mglData
a, char
dir, int
sVal=-1
, const char *
stl=NULL
, int
num=7
)
The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
Cont3 (mglData
a, char
dir, int
sVal=-1
, const char *
sch=NULL
, int
num=7
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
ContA (mglData
x, mglData
y, mglData
z, mglData
a, const char *
stl=NULL
, int
num=7
)
Draws contour plots at all central slices of the 3d data specified parametrically.
void
ContA (mglData
a, const char *
sch=NULL
, int
num=7
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
ContF3 (mglData
v, mglData
x, mglData
y, mglData
z, mglData
a, char
dir, int
sVal=-1
, const char *
stl=NULL
)
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 dir={‘x’, ‘y’, ‘z’} direction. String sch sets the color scheme. Previous color scheme is used by default. If string stl have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). See also Dens3, Cont3, ContF, Grid3. See section ContF3 sample, for sample code and picture.
void
ContF3 (mglData
v, mglData
a, char
dir, int
sVal=-1
, const char *
sch=NULL
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
ContF3 (mglData
x, mglData
y, mglData
z, mglData
a, char
dir, int
sVal=-1
, const char *
stl=NULL
, int
num=7
)
The same as first one with vector v of num-th elements equidistantly distributed in range [Cmin, Cmax].
void
ContF3 (mglData
a, char
dir, int
sVal=-1
, const char *
sch=NULL
, int
num=7
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
ContFA (mglData
x, mglData
y, mglData
z, mglData
a, const char *
stl=NULL
, int
num=7
)
Draws contour plots at all central slices of the 3d data specified parametrically.
void
ContFA (mglData
a, const char *
sch=NULL
, int
num=7
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Grid3 (mglData
x, mglData
y, mglData
z, mglData
a, char
dir, int
sVal=-1
, const char *
stl=NULL
)
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]). Density is plotted at slice sVal in dir={‘x’, ‘y’, ‘z’} direction. String sch sets the color scheme. Previous color scheme is used by default. If string stl have symbol ‘#’ then grid lines are drawn. The minor dimensions of arrays x, y, z must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). See also Cont3, ContF3, Dens3, Grid.
void
Grid3 (mglData
a, char
dir, int
sVal=-1
, const char *
sch=NULL
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
GridA (mglData
x, mglData
y, mglData
z, mglData
a, const char *
stl=NULL
)
Draws grids at all central slices of the 3d data specified parametrically.
void
GridA (mglData
a, const char *
sch=NULL
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Cloud (mglData
x, mglData
y, mglData
z, mglData
a, const char *
stl=NULL
, float
alpha=1
)
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 (see section Other settings). String sch sets the color scheme. Previous color scheme is used by default. Parameter alpha changes the overall transparency of plot. The minor dimensions of arrays x, y, z must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). See also Surf3. See section CloudQ sample, for sample code and picture.
void
Cloud (mglData
a, const char *
stl=NULL
, float
alpha=1
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Beam (float
val, mglData
tr, mglData
g1, mglData
g2, mglData
a, float
r, const char *
stl=NULL
, int
flag=0
)
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 section Surf3.
void
Beam (mglData
tr, mglData
g1, mglData
g2, mglData
a, float
r, const char *
stl=NULL
, int
flag=0
, int
num=3
)
Draws num-th uniformly distributed in range [Cmin, Cmax] isosurfaces for 3d data specified parametrically.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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). Surf3A and Surf3C have variants for automatic and manual selection of level values for isosurfaces. 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 section Color scheme.
9.12.1 SurfC (Python) | ||
9.12.2 Surf3C (Python) | ||
9.12.3 SurfA (Python) | ||
9.12.4 Surf3A (Python) | ||
9.12.5 TileS (Python) | ||
9.12.6 Map (Python) | ||
9.12.7 STFA (Python) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
SurfC (mglData
x, mglData
y, mglData
z, mglData
c, const char *
sch=NULL
)
The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]} and color it by matrix c[i,j]. String sch sets the color scheme. Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. All dimensions of arrays z and c must be equal. 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). Surface is plotted for each z slice of the data. See also Surf, SurfA, Surf3C. See section SurfC sample, for sample code and picture.
void
SurfC (mglData
z, mglData
c, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Surf3C (float
val, mglData
x, mglData
y, mglData
z, mglData
a, mglData
c, const char *
stl=NULL
)
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. String sch sets the color scheme. Previous color scheme is used by default. If string contain ‘#’ then wire plot is produced. All dimensions of arrays z and c must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). 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 Surf3, SurfC, Surf3A. See section Surf3C sample, for sample code and picture.
void
Surf3C (float
val, mglData
a, mglData
c, const char *
sch=NULL
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
Surf3C (mglData
x, mglData
y, mglData
z, mglData
a, mglData
c, const char *
stl=NULL
, int
num=3
)
Draws num-th uniformly distributed in range [Cmin, Cmax] isosurfaces for 3d data specified parametrically.
void
Surf3C (mglData
a, mglData
c, const char *
sch=NULL
, int
num=3
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
SurfA (mglData
x, mglData
y, mglData
z, mglData
c, const char *
sch=NULL
)
The function draws surface specified parametrically {x[i,j], y[i,j], z[i,j]} and transparent it by matrix c[i,j]. String sch sets the color scheme. Previous color scheme is used by default. If string sch have symbol ‘#’ then grid lines are drawn. All dimensions of arrays z and c must be equal. 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). Surface is plotted for each z slice of the data. See also Surf, SurfC, Surf3A, TileS. See section SurfA sample, for sample code and picture.
void
SurfA (mglData
z, mglData
c, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Surf3A (float
val, mglData
x, mglData
y, mglData
z, mglData
a, mglData
c, const char *
stl=NULL
)
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 b array. This allows one to remove the part of isosurface where b is negligibly small (useful for phase plotting of a beam or a pulse). String sch sets the color scheme. Previous color scheme is used by default. If string contain ‘#’ then wire plot is produced. All dimensions of arrays z and c must be equal. Arrays x, y, z can be vectors (not 3d arrays as a). 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 Surf3, SurfA, Surf3C. See section Surf3A sample, for sample code and picture.
void
Surf3A (float
val, mglData
a, mglData
c, const char *
sch=NULL
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
void
Surf3A (mglData
x, mglData
y, mglData
z, mglData
a, mglData
c, const char *
stl=NULL
, int
num=3
)
Draws num-th uniformly distributed in range [Cmin, Cmax] isosurfaces for 3d data specified parametrically.
void
Surf3A (mglData
a, mglData
c, const char *
sch=NULL
, int
num=3
)
The same as previous with x, y, z equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
TileS (mglData
x, mglData
y, mglData
z, mglData
r, const char *
sch=NULL
)
The function draws horizontal tiles for surface specified parametrically {x[i,j], y[i,j], z[i,j]}. It is mostly the same as Tile() but the size of tiles is determined by r array. This is some kind of “transparency” useful for exporting to EPS files. String sch sets the color scheme. Previous color scheme is used by default. 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). Surface is plotted for each z slice of the data. See also SurfA, Tile. See section Tiles sample, for sample code and picture.
void
TileS (mglData
z, mglData
c, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Map (mglData
x, mglData
y, mglData
ax, mglData
ay, const char *
sch=NULL
, int
ks=0
, bool
pnts=true
)
The function draws mapping plot for matrices {ax, ay } which parametrically depend on coordinates x, y. The previous position of the cell (point) is marked by color. Height is proportional to Jacobian(ax,ay). This plot is like Arnold diagram ???. If pnts=false
then face is drawn otherwise the color ball at matrix knots are drawn. Parameter ks specifies the slice of matrices which will be used. String sch sets the color scheme. Previous color scheme is used by default. The size of ax and ay must be the same. The minor dimensions of arrays x, y, ax should be equal. Arrays x, y can be vectors (not matrix as ax). See section Color scheme. See section Map sample, for sample code and picture.
void
Map (mglData
ax, mglData
ay, const char *
sch=NULL
, int
ks=0
, bool
pnts=true
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
STFA (mglData
x, mglData
y, mglData
re, mglData
im, int
dn, const char *
sch=NULL
, float
zVal=NAN
)
Draws spectrogram of complex array re+i*im
for Fourier size of dn points at plane z=zVal. Parameter dn is arbitrary even integer. 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. String sch sets the color scheme. Previous color scheme is used by default. 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). See section Color scheme.
void
STFA (mglData
re, mglData
im, int
dn, const char *
sch=NULL
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions perform plotting of 2D and 3D vector fields. There are 5 generally different types of vector fields representations: simple vector field (Vect), vector field with coloring (VectC), vector field by dew-drops (Dew), flow threads (Flow), flow pipes (Pipe). 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 section Color scheme.
9.13.1 Traj (Python) | ||
9.13.2 Vect (Python) | ||
9.13.3 VectC (Python) | ||
9.13.4 Dew (Python) | ||
9.13.5 Flow (Python) | ||
9.13.6 Pipe (Python) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Traj (const mglData &
x, const mglData &
y, const mglData &
z, const mglData &
ax, const mglData &
ay, const mglData &
az, const char *
sch=NULL
, float
len=0
)
void
Traj (const mglData &
x, const mglData &
y, const mglData &
ax, const mglData &
ay, const char *
sch=NULL
, float
zVal=NAN
, float
len=0
)
The function draws vectors {ax, ay, az} along a curve {x, y, z}. The length and color of arrows are proportional to \sqrt{ax^2+ay^2+az^2}. The color is specified by the string argument sch. Previous color scheme is used by default. Parameter len set the vector length factor (if non-zero) or vector length to be proportional the distance between curve points (if len=0). The minor sizea of all arrays must be equal and large 2. Vectors are plotted for each column of the arrays. See also Vect. See section Traj sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Vect (mglData
x, mglData
y, mglData
ax, mglData
ay, const char *
sch=NULL
, float
zVal=NAN
, int
flag=0
)
The function draws plane vector field plot for the field {ax, ay} depending parametrically on coordinates x, y at level z=zVal. The length of hachures is proportional to \sqrt{ax^2+ay^2}. The number of hachures depend on MeshNum (see section Other settings). The color is specified by the string argument sch. Previous color scheme is used by default. Parameter flag setup the hachures (arrows). It is compination of vlaues: MGL_VEC_COL
for drawing bi-color arrow, MGL_VEC_LEN
for drawing fixed length arrows, MGL_VEC_DOT
for drawing hachures with dots instead of arrows, MGL_VEC_END
for drawing arrows to the cell point, MGL_VEC_MID
for drawing arrows with center at cell point. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also VectC, Flow, Dew. See section Vect sample, for sample code and picture.
void
Vect (mglData
ax, mglData
ay, const char *
sch=NULL
, float
zVal=NAN
, int
flag=0
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
Vect (mglData
x, mglData
y, mglData
z, mglData
ax, mglData
ay, mglData
az, const char *
sch=NULL
, int
flag=0
)
This is 3D version of the first functions. Here arrays ax, ay, az must be 3-ranged tensors with equal sizes and the length of hachures is proportional to \sqrt{ax^2+ay^2+az^2}. See section Vect 3D sample, for sample code and picture.
void
Vect (mglData
ax, mglData
ay, mglData
az, const char *
sch=NULL
, int
flag=0
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions are obsolete – use Vect() functions instead.
void
VectC (mglData
x, mglData
y, mglData
ax, mglData
ay, const char *
sch=NULL
, float
zVal=NAN
)
The function draws plane vector field plot for the field {ax, ay} depending parametrically on coordinates x, y at level z=zVal. The color of hachures is proportional to \sqrt{ax^2+ay^2}. The number of hachures depend on MeshNum (see section Other settings). The color is specified by the string argument sch. Previous color scheme is used by default. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also Vect, Flow, Dew. See section VectC sample, for sample code and picture.
void
VectC (mglData
ax, mglData
ay, const char *
sch=NULL
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
VectC (mglData
x, mglData
y, mglData
z, mglData
ax, mglData
ay, mglData
az, const char *
sch=NULL
)
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 hachures is proportional to \sqrt{ax^2+ay^2+az^2}. See section VectC 3D sample, for sample code and picture.
void
VectC (mglData
ax, mglData
ay, mglData
az, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Dew (mglData
x, mglData
y, mglData
ax, mglData
ay, const char *
sch=NULL
, float
zVal=NAN
)
The function draws dew-drops for plane vector field {ax, ay} depending parametrically on coordinates x, y at level z=zVal. 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 section Other settings). The color is specified by the string argument sch. Previous color scheme is used by default. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also Vect, VectC. See section Dew sample, for sample code and picture.
void
Dew (mglData
ax, mglData
ay, const char *
sch=NULL
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Flow (mglData
x, mglData
y, mglData
ax, mglData
ay, const char *
sch=NULL
, int
num=5
, bool
central=true
, float
zVal=NAN
)
The function draws flow threads for the plane vector field {ax, ay} parametrically depending on coordinates x, y at level z = zVal. Number of threads is proportional to num. Parameter central sets the thread start from center (if true) or only from edges (if false). 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). String sch sets the color scheme. Previous color scheme is used by default. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also Pipe, VectC, Vect. See section Flow sample, for sample code and picture.
void
Flow (mglData
ax, mglData
ay, const char *
sch=NULL
, int
num=5
, bool
central=true
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
Flow (mglData
x, mglData
y, mglData
z, mglData
ax, mglData
ay, mglData
az, const char *
sch=NULL
, int
num=3
, bool
central=true
)
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}. See section Flow 3D sample, for sample code and picture.
void
Flow (mglData
ax, mglData
ay, mglData
az, const char *
sch=NULL
, int
num=3
, bool
central=true
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
Flow (float
x0, float
y0, float
z0, mglData
x, mglData
y, mglData
ax, mglData
ay, const char *
sch=NULL
)
The function draws flow threads for the plane vector field {ax, ay} parametrically depending on coordinates x, y from point {x0, y0} at level z = z0. 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). String sch sets the color scheme. Previous color scheme is used by default. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also Pipe, VectC, Vect. See section Flow sample, for sample code and picture.
void
Flow (float
x0, float
y0, float
z0, mglData
ax, mglData
ay, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
Flow (float
x0, float
y0, float
z0, mglData
x, mglData
y, mglData
z, mglData
ax, mglData
ay, mglData
az, const char *
sch=NULL
)
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}. See section Flow 3D sample, for sample code and picture.
void
Flow (float
x0, float
y0, float
z0, mglData
ax, mglData
ay, mglData
az, const char *
sch=NULL
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Pipe (mglData
x, mglData
y, mglData
ax, mglData
ay, const char *
sch=NULL
, float
r0=0.05
, int
num=5
, bool
central=true
, float
zVal=NAN
)
The function draws flow pipes for the plane vector field {ax, ay} parametrically depending on coordinates x, y at level z = zVal. Number of pipes is proportional to num. Parameter central sets the pipe start from center (if true) or only from edges (if false). 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). String sch sets the color scheme. Previous color scheme is used by default. Parameter r0 set the base pipe radius. If r0<0 then pipe radius is inverse proportional to amplitude. The size of ax and ay must be equal. The minor dimensions of arrays x, y and ax must be equal too. Arrays x and y can be vectors (not matrices as ax). The vector field is plotted for each z slice of ax, ay. See also Pipe, VectC, Vect. See section Pipe sample, for sample code and picture.
void
Pipe (mglData
ax, mglData
ay, const char *
sch=NULL
, float
r0=0.05
, int
num=5
, bool
central=true
, float
zVal=NAN
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
void
Pipe (mglData
x, mglData
y, mglData
z, mglData
ax, mglData
ay, mglData
az, const char *
sch=NULL
, float
r0=0.05
, int
num=3
, bool
central=true
)
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}. See section Pipe 3D sample, for sample code and picture.
void
Pipe (mglData
ax, mglData
ay, mglData
az, const char *
sch=NULL
, float
r0=0.05
, int
num=3
, bool
central=true
)
The same as previous with x, y equidistantly distributed in interval [Min, Max].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions perform miscelaneous plotting. There is unstructured data points plots (Dots), surface reconstruction (Crust), surfaces on the triangular mesh (TriPlot), textual formula plotting (Plots by formula), data plots at edges (Dens[XYZ], Cont[XYZ], ContF[XYZ]), simple plot (SimplePlot). 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 section Color scheme.
9.14.1 DensXYZ (Python) | ||
9.14.2 ContXYZ (Python) | ||
9.14.3 ContFXYZ (Python) | ||
9.14.4 Dots (Python) | ||
9.14.5 Crust (Python) | ||
9.14.6 TriPlot (Python) | ||
9.14.7 Plots by formula (Python) | ||
9.14.8 SimplePlot (Python) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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. See section Dens projection sample, for sample code and picture.
void
DensX (mglData
a, const char *
stl=NULL
, float
sVal=NAN
)
Draws density plot for data a at x = sVal.
void
DensY (mglData
a, const char *
stl=NULL
, float
sVal=NAN
)
Draws density plot for data a at y = sVal.
void
DensZ (mglData
a, const char *
stl=NULL
, float
sVal=NAN
)
Draws density plot for data a at z = sVal.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 ContFXYZ, DensXYZ, Cont. See section Cont projection sample, for sample code and picture.
void
ContX (mglData
a, const char *
stl=NULL
, float
sVal=NAN
, int
num=7
)
Draws num-th contour lines for data a at x = sVal.
void
ContY (mglData
a, const char *
stl=NULL
, float
sVal=NAN
, int
num=7
)
Draws num-th contour lines for data a at y = sVal.
void
ContZ (mglData
a, const char *
stl=NULL
, float
sVal=NAN
, int
num=7
)
Draws num-th contour lines for data a at z = sVal.
void
ContX (mglData
v, mglData
a, const char *
stl=NULL
, float
sVal=NAN
)
Draws contour lines for data a=v[i] at x = sVal.
void
ContY (mglData
v, mglData
a, const char *
stl=NULL
, float
sVal=NAN
)
Draws contour lines for data a=v[i] at y = sVal.
void
ContZ (mglData
v, mglData
a, const char *
stl=NULL
, float
sVal=NAN
)
Draws contour lines for data a=v[i] at z = sVal.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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, DensXYZ, ContF.
void
ContFX (mglData
a, const char *
stl=NULL
, float
sVal=NAN
, int
num=7
)
Draws num-th solid contours for data a at x = sVal.
void
ContFY (mglData
a, const char *
stl=NULL
, float
sVal=NAN
, int
num=7
)
Draws num-th solid contours for data a at y = sVal.
void
ContFZ (mglData
a, const char *
stl=NULL
, float
sVal=NAN
, int
num=7
)
Draws num-th solid contours for data a at z = sVal.
void
ContFX (mglData
v, mglData
a, const char *
stl=NULL
, float
sVal=NAN
)
Draws solid contours for data a=v[i] at x = sVal.
void
ContFY (mglData
v, mglData
a, const char *
stl=NULL
, float
sVal=NAN
)
Draws solid contours for data a=v[i] at y = sVal.
void
ContFZ (mglData
v, mglData
a, const char *
stl=NULL
, float
sVal=NAN
)
Draws solid contours for data a=v[i] at z = sVal.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Dots (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
)
void
Dots (mglData
x, mglData
y, mglData
z, mglData
a, const char *
sch=NULL
)
The function draws the arbitrary placed points {x[i], y[i], z[i]}. String sch sets the color scheme. Previous color scheme is used by default. If array a is specified then it define the transparency of dots. Arrays x, y, z, a must have equal sizes. See also Crust, Mark, Plot. See section Dots sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
Crust (mglData
x, mglData
y, mglData
z, const char *
sch=NULL
, float
er=0
)
The function reconstruct and draws the surface for arbitrary placed points {x[i], y[i], z[i]}. Parameter er set relative radius for (increase it for removing holes). String sch sets the color scheme. Previous color scheme is used by default. If string contain ‘#’ then wire plot is produced. Arrays x, y, z must have equal sizes. See also Dots, TriPlot. See section Crust sample, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
TriPlot (const mglData &
id, const mglData &
x, const mglData &
y, const mglData &
z, const mglData &
c, const char *
sch=NULL
)
void
TriPlot (const mglData &
id, const mglData &
x, const mglData &
y, const mglData &
z, const char *
sch=NULL
)
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. Previous color scheme is used by default. 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.
void
TriPlot (mglData
id, mglData
x, mglData
y, const char *
sch=NULL
, float
zVal=NAN
)
The same as previous with z[i]=zVal.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions perform plotting of 1D or 2D functions specified by textual formula. You do not need to create the data arrays to plot it. The parameter stl set the line style (see section Line styles) for Plot()
or color scheme (see section Color scheme) for Surf()
. The parameter n set the minimal number of points along coordinate(s) for plots. At this time (v. 1.7) there is no adaptive increase of data points numbers but in future it will appear.
void
Plot (const char *
eqY, const char *
stl=NULL
, float
zVal=NAN
, int
n=100
)
The function draws function ‘eqY(x)’ at plane z=zVal where ‘x’ variable is changed in range [Min.x, Max.x]. See also Plot.
void
Plot (const char *
eqX, const char *
eqY, const char *
eqZ, const char *
stl=NULL
, float
zVal=NAN
, int
n=100
)
The function draws parametrical curve {‘eqX(t)’, ‘eqY(t)’, ‘eqZ(t)’} where ‘t’ variable is changed in range [0, 1]. See also Plot.
void
Surf (const char *
eqZ, const char *
stl=NULL
, int
n=100
);
The function draws surface for function ‘eqY(x,y)’ where ‘x’, ‘y’ variables are changed in range [Min, Max]. See also Surf.
void
Surf (const char *
eqX, const char *
eqY, const char *
eqZ, const char *
stl=NULL
, int
n=100
)
The function draws parametrical surface {‘eqX(u,v)’, ‘eqY(u,v)’, ‘eqZ(u,v)’} where ‘u’, ‘v’ variables are changed in range [0, 1]. See also Surf.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void
SimplePlot (mglData
a, int
type=0
, const char *
stl=NULL
)
Plots the array a depending on it's dimensions and type parameter. String stl specifies the style of plotting. For 1d data: type=0
– Plot, type=1
– Area, type=2
– Step, type=3
– Stem, type=4
– Bars. For 2d data: type=0
– Surf, type=1
– Dens, type=2
– Mesh, type=3
– Cont. For 3d data: type=0
– Surf3, type=1
– Dens3, type=2
– Cont3, type=2
– Cloud.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 section 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 the \chi^2 error of approximation. At this, the ‘x,y,z’ coordinates are equidistantly distributed in the interval Min–Max. Number of points in fit is selected as maximal value of fit size and the value of FitPnts. Note, that this functions use GSL library and do something only if MathGL was compiled with GSL support. See section Fitting sample, for sample code and picture.
float
FitS (mglData
fit, mglData
x, mglData
y, mglData
z, mglData
a, mglData
s, const char *
func, const char *
var, float *
ini=NULL
, bool
print=false
)
float
FitS (mglData
fit, mglData
x, mglData
y, mglData
z, mglData
a, mglData
s, const char *
func, const char *
var, mglData
ini, bool
print=false
)
Fit data along x-, y- and z-directions for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]).
float
FitS (mglData
fit, mglData
x, mglData
y, mglData
a, mglData
s, const char *
func, const char *
var, float *
ini=NULL
, bool
print=false
)
float
FitS (mglData
fit, mglData
x, mglData
y, mglData
a, mglData
s, const char *
func, const char *
var, mglData
ini, bool
print=false
)
Fit data along x-, and y-directions for 2d array specified parametrically a[i,j](x[i,j], y[i,j]) for each data slice.
float
FitS (mglData
fit, mglData
x, mglData
a, mglData
s, const char *
func, const char *
var, float *
ini=NULL
, bool
print=false
)
float
FitS (mglData
fit, mglData
x, mglData
a, mglData
s, const char *
func, const char *
var, mglData
ini, bool
print=false
)
Fit data along x-direction for 1d array specified parametrically a[i](x[i]) for each data slice.
float
FitS (mglData
fit, mglData
a, mglData
s, const char *
func, const char *
var, float *
ini=NULL
, bool
print=false
)
float
FitS (mglData
fit, mglData
a, mglData
s, const char *
func, const char *
var, mglData
ini, bool
print=false
)
Fit data along x-direction for 1d array with x equidistantly distributed in interval [Min.x, Max.x].
float
Fit (mglData
fit, mglData
x, mglData
y, mglData
z, mglData
a, const char *
func, const char *
var, float *
ini=NULL
, bool
print=false
)
float
Fit (mglData
fit, mglData
x, mglData
y, mglData
z, mglData
a, const char *
func, const char *
var, mglData
ini, bool
print=false
)
Fit data along x-, y- and z-directions for 3d array specified parametrically a[i,j,k](x[i,j,k], y[i,j,k], z[i,j,k]) with s[i,j,k]=1.
float
Fit (mglData
fit, mglData
x, mglData
y, mglData
a, const char *
func, const char *
var, float *
ini=NULL
, bool
print=false
)
float
Fit (mglData
fit, mglData
x, mglData
y, mglData
a, const char *
func, const char *
var, mglData
ini, bool
print=false
)
Fit data along x-, and y-directions for 2d array specified parametrically a[i,j](x[i,j], y[i,j]) with s[i,j]=1 for each data slice.
float
Fit (mglData
fit, mglData
x, mglData
a, const char *
func, const char *
var, float *
ini=NULL
, bool
print=false
)
float
Fit (mglData
fit, mglData
x, mglData
a, const char *
func, const char *
var, mglData
ini, bool
print=false
)
Fit data along x-direction for 1d array specified parametrically a[i](x[i]) with s[i]=1 for each data slice.
float
Fit (mglData
fit, mglData
a, const char *
func, const char *
var, float *
ini=NULL
, bool
print=false
)
float
Fit (mglData
fit, mglData
a, const char *
func, const char *
var, mglData
ini, bool
print=false
)
Fit data along x-direction for 1d array a with s=1 and x equidistantly distributed in interval [Min.x, Max.x].
float
Fit2 (mglData
fit, mglData
a, const char *
func, const char *
var, float *
ini=NULL
, bool
print=false
)
float
Fit2 (mglData
fit, mglData
a, const char *
func, const char *
var, mglData
ini, bool
print=false
)
Fit data along x-, and y-directions for 2d array a with s=1 and x, y equidistantly distributed in interval [Min, Max].
float
Fit3 (mglData
fit, mglData
a, const char *
func, const char *
var, float *
ini=NULL
, bool
print=false
)
float
Fit3 (mglData
fit, mglData
a, const char *
func, const char *
var, mglData
ini, bool
print=false
)
Fit data along x-, y- and z-directions for 3d array a with s=1 and x, y, z equidistantly distributed in interval [Min, Max].
void
PutsFit (mglPoint
p, const char *
prefix=NULL
, const char *
font=NULL
, float
size=-1
)
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.
void
int
FitPnts
Minimal number of points for output array after nonlinear fitting.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions provide ability to create several pictures simultaneously. Later, you can write several frames into animated GIF file.
int
NewFrame ()
Creates new frame. Function returns current frame id. The function EndFrame()
must be call after the finishing of the frame drawing for each call of this function.
void
EndFrame ()
Finishes the frame drawing.
int
GetNumFrame ()
Gets the number of created frames.
void
ResetFrames ()
Reset frames counter (start it from zero).
void
StartGIF (const char *
fname, int
ms=100
)
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.
int
CloseGIF ()
Finish writing animated GIF and close connected pointers.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on September, 14 2009 using texi2html 1.78.