[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Functions and variables in this group influences on overall graphics appearance. So all of them should be placed before any actual plotting function calls.
mglGraph
: void
DefaultPlotParam ()void
mgl_set_def_param (HMGL
gr)Restore initial values for all of parameters.
4.2.1 Transparency | ||
4.2.2 Lighting | ||
4.2.3 Fog | ||
4.2.4 Default sizes | ||
4.2.5 Cutting | ||
4.2.6 Font settings | ||
4.2.7 Palette and colors | ||
4.2.8 Error handling |
[ < ] | [ > ] | [ << ] | [ 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 (with one exception, OpenGL). Function alphadef specify the default value of alpha-channel. Finally, function transptype set the kind of transparency. See section Transparency and lighting, for sample code and picture.
[val=on]
mglGraph
: void
Alpha (bool
enable)void
mgl_set_alpha (HMGL
gr, int
enable)Sets the transparency on/off and returns previous value of transparency. It is recommended to call this function before any plotting command. Default value is transparency off.
val
mglGraph
: void
SetAlphaDef (mreal
val)void
mgl_set_alpha_default (HMGL
gr, mreal
alpha)Sets default value of alpha channel (transparency) for all plotting functions. Initial value is 0.5.
val
mglGraph
: void
SetTranspType (int
type)void
mgl_set_transp_type (HMGL
gr, int
type)Set the type of transparency. Possible values are:
SetAlphaDef(0.3)
or less for lamp-like transparency.
See section Types of transparency, for sample code and picture..
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are several functions for setup lighting. The general function is light which switch on/off the lighting for overall plot. It influence only for graphics which created after light call (with one exception, OpenGL). Generally MathGL support up to 10 independent light sources. But in OpenGL mode only 8 of light sources is used due to OpenGL limitations. The position, color, brightness of each light source can be set separately. By default only one light source is active. It is source number 0
with white color, located at top of the plot.
[val=on]
mglGraph
: bool
Light (bool
enable)void
mgl_set_light (HMGL
gr, int
enable)Sets the using of light on/off for overall plot. Function returns previous value of lighting. Default value is lightning off.
num
val
mglGraph
: void
Light (int
n, bool
enable)void
mgl_set_light_n (HMGL
gr, int
n, int
enable)Switch on/off n-th light source separately.
num xdir ydir zdir
['col'='w' br=0.5
]num xdir ydir zdir xpos ypos zpos
['col'='w' br=0.5
]mglGraph
: void
AddLight (int
n, mglPoint
d, char
c='w'
, mreal
bright=0.5
, mreal
ap=0
)mglGraph
: void
AddLight (int
n, mglPoint
r, mglPoint
d, char
c='w'
, mreal
bright=0.5
, mreal
ap=0
)void
mgl_add_light (HMGL
gr, int
n, mreal
dx, mreal
dy, mreal
dz)void
mgl_add_light_ext (HMGL
gr, int
n, mreal
dx, mreal
dy, mreal
dz, char
c, mreal
bright, mreal
ap)void
mgl_add_light_loc (HMGL
gr, int
n, mreal
rx, mreal
ry, mreal
rz, mreal
dx, mreal
dy, mreal
dz, char
c, mreal
bright, mreal
ap)The function adds a light source with identification n in direction d with color c and with brightness bright (which must be in range [0,1]). If position r is specified and isn’t NAN then light source is supposed to be local otherwise light source is supposed to be placed at infinity.
mglGraph
: void
SetDifLight (bool
enable)void
mgl_set_light_dif (HMGL
gr, int
enable)Set on/off to use diffusive light (only for local light sources).
val
mglGraph
: void
SetAmbient (mreal
bright=0.5
)void
mgl_set_ambbr (HMGL
gr, mreal
bright)Sets the brightness of ambient light. The value should be in range [0,1].
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
val [dz=0.25]
mglGraph
: void
Fog (mreal
d, mreal
dz=0.25
)void
mgl_set_fog (HMGL
gr, mreal
d, mreal
dz)Function imitate a fog in the plot. Fog start from relative distance dz from view point and its density growths exponentially in depth. So that the fog influence is determined by law ~ 1-exp(-d*z). Here z is normalized to 1 depth of the plot. If value d=0
then the fog is absent. Note, that fog was applied at stage of image creation, not at stage of drawing. See section Adding fog, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These variables control the default (initial) values for most graphics parameters including sizes of markers, arrows, line width and so on. As any other settings these ones will influence only on plots created after the settings change.
val
mglGraph
: void
SetBarWidth ( mreal
val)void
mgl_set_bar_width (HMGL
gr, mreal
val)Sets relative width of rectangles in bars, barh, boxplot, candle. Default value is 0.7
.
val
mglGraph
: void
SetMarkSize (mreal
val)void
mgl_set_mark_size (HMGL
gr, mreal
val)Sets size of marks for 1D plotting. Default value is 1
.
val
mglGraph
: void
SetArrowSize (mreal
val)void
mgl_set_arrow_size (HMGL
gr, mreal
val)Sets size of arrows for 1D plotting, lines and curves (see Primitives). Default value is 1
.
val
mglGraph
: void
SetMeshNum (int
val)void
mgl_set_meshnum (HMGL
gr, int
num)Sets approximate number of lines in mesh, fall, grid and also the number of hachures in vect, dew and the number of cells in cloud. By default (=0) it draws all lines/hachures/cells.
val
mglGraph
: void
SetFaceNum (int
val)void
mgl_set_facenum (HMGL
gr, int
num)Sets approximate number of visible faces. Can be used for speeding up drawing by cost of lower quality. By default (=0) it draws all of them.
mglGraph
: void
SetPlotId (const char *
id)void
mgl_set_plotid (HMGL
gr, const char *
id)Sets default name id as filename for saving (in FLTK window for example).
mglGraph
: const char *
GetPlotId ()const char *
mgl_get_plotid (HMGL
gr)Gets default name id as filename for saving (in FLTK window for example).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These variables and functions set the condition when the points are excluded (cutted) from the drawing. Note, that a point with NAN value(s) of coordinate or amplitude will be automatically excluded from the drawing. See section Cutting sample, for sample code and picture.
val
mglGraph
: void
SetCut (bool
val)void
mgl_set_cut (HMGL
gr, int
val)Flag which determines how points outside bounding box are drawn. If it is true
then points are excluded from plot (it is default) otherwise the points are projected to edges of bounding box.
x1 y1 z1 x2 y2 z2
mglGraph
: void
SetCutBox (mglPoint
p1, mglPoint
p1)void
mgl_set_cut_box (HMGL
gr, mreal
x1, mreal
y1, mreal
z1, mreal
x2, mreal
y2, mreal
z2)Lower and upper edge of the box in which never points are drawn. If both edges are the same (the variables are equal) then the cutting box is empty.
mglGraph
: void
CutOff (const char *
cond)void
mgl_set_cutoff (HMGL
gr, const char *
cond)Sets the cutting off condition by formula cond. This condition determine will point be plotted or not. If value of formula is nonzero then point is omitted, otherwise it plotted. Set argument as ""
to disable cutting off condition.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
val=6
]Font style for text and labels (see text). Initial style is ’fnt’=’:rC’ give Roman font with centering. Parameter val
sets the size of font for tick and axis labels. Default font size of axis labels is 1.4 times large than for tick labels. For more detail, see Font styles.
val
mglGraph
: void
SetRotatedText (bool
val)void
mgl_set_rotated_text (HMGL
gr, int
val)Sets to use or not text rotation.
mglGraph
: void
LoadFont (const char *
name, const char *
path=""
)void
mgl_load_font (HMGL
gr, const char *
name, const char *
path)Load font typeface from path/name. Empty name will load default font.
mglGraph
: void
SetFontDef (const char *
fnt)void
mgl_set_font_def (HMGL
gr, const char *
val)Sets the font specification (see Text printing). Default is ‘rC’ – Roman font centering.
mglGraph
: void
SetFontSize (mreal
val)void
mgl_set_font_size (HMGL
gr, mreal
val)Sets the size of font for tick and axis labels. Default font size of axis labels is 1.4 times large than for tick labels.
mglGraph
: void
SetFontSizePT (mreal
cm, int
dpi=72
)Set FontSize by size in pt and picture DPI (default is 16 pt for dpi=72).
mglGraph
: inline void
SetFontSizeCM (mreal
cm, int
dpi=72
)Set FontSize by size in centimeters and picture DPI (default is 0.56 cm = 16 pt).
mglGraph
: inline void
SetFontSizeIN (mreal
cm, int
dpi=72
)Set FontSize by size in inch and picture DPI (default is 0.22 in = 16 pt).
mglGraph
: void
LoadFont (const char *
name, const char *
path=""
)void
mgl_load_font (HMGL
gr, const char *
name, const char *
path)Load font typeface from path/name.
mglGraph
: void
CopyFont (mglGraph *
from)void
mgl_copy_font (HMGL
gr, HMGL
gr_from)Copy font data from another mglGraph
object.
mglGraph
: void
RestoreFont ()void
mgl_restore_font (HMGL
gr)Restore font data to default typeface.
void
mgl_def_font (const char *
name, const char *
path)Load default font typeface (for all newly created HMGL/mglGraph objects) from path/name.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mglGraph
: void
SetPalette (const char *
colors)void
mgl_set_palette (HMGL
gr, const char *
colors)Sets the palette as selected colors. Default value is "Hbgrcmyhlnqeup"
that corresponds to colors: dark gray ‘H’, blue ‘b’, green ‘g’, red ‘r’, cyan ‘c’, magenta ‘m’, yellow ‘y’, gray ‘h’, blue-green ‘l’, sky-blue ‘n’, orange ‘q’, yellow-green ‘e’, blue-violet ‘u’, purple ‘p’. The palette is used mostly in 1D plots (see 1D plotting) for curves which styles are not specified. Internal color counter will be nullified by any change of palette. This includes even hidden change (for example, by box or axis functions).
mglGraph
: void
SetDefScheme (const char *
sch)void
mgl_set_def_sch (HMGL
gr, const char *
sch)Sets the sch as default color scheme. Default value is "BbcyrR"
.
void
mgl_set_color (char
id, mreal
r, mreal
g, mreal
b)Sets RGB values for color with given id.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Normally user should set it to zero by SetWarn(0);
before plotting and check if GetWarnCode()
or Message()
return non zero after plotting. Only last warning will be saved. All warnings/errors produced by MathGL is not critical – the plot just will not be drawn.
mglGraph
: void
SetWarn (int
code, const char *
info=""
)void
mgl_set_warn (HMGL
gr, int
code, const char *
info)Set warning code. Normally you should call this function only for clearing the warning state, i.e. call SetWarn(0);
. Text info will be printed as is if code<0.
mglGraph
: const char *
Message ()const char *
mgl_get_mess (HMGL
gr)Return messages about matters why some plot are not drawn. If returned string is empty then there are no messages.
mglGraph
: int
GetWarnCode ()int
mgl_get_warn_code (HMGL
gr)Return the numerical ID of warning about the not drawn plot. Possible values are:
mglWarnNone=0
Everything OK
mglWarnDim
Data dimension(s) is incompatible
mglWarnLow
Data dimension(s) is too small
mglWarnNeg
Minimal data value is negative
mglWarnFile
No file or wrong data dimensions
mglWarnMem
Not enough memory
mglWarnZero
Data values are zero
mglWarnLegA
Too many legend entries
mglWarnLeg
No legend entries
mglWarnSlc
Slice value is out of range
mglWarnCnt
Number of contours is zero or negative
mglWarnOpen
Couldn’t open file
mglWarnLId
Light: ID is out of range
mglWarnSize
Setsize: size(s) is zero or negative
mglWarnFmt
Format is not supported for that build
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated on February 17, 2014 using texi2html 1.82.