[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These large set of variables and functions control how the axis and ticks will be drawn. Note that there is 3-step transformation of data coordinates are performed. Firstly, coordinates are projected if Cut=true
(see Cutting), after it transformation formulas are applied, and finally the data was normalized in bounding box.
4.3.1 Ranges (bounding box) | ||
4.3.2 Curved coordinates | ||
4.3.3 Ticks |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
v1 v2
v1 v2
v1 v2
v1 v2
mglGraph
: void
SetRange (char
dir, mreal
v1, mreal
v2)void
mgl_set_range_val (HMGL
gr, char
dir, mreal
v1, mreal
v2)Sets the range for ‘x’-,‘y’-,‘z’- coordinate or coloring (‘c’). See also ranges.
add=off
]add=off
]add=off
]add=off
]mglGraph
: void
SetRange (char
dir, const mglDataA &
dat, bool
add=false
)void
mgl_set_range_dat (HMGL
gr, char
dir, const HCDT
a, int
add)Sets the range for ‘x’-,‘y’-,‘z’- coordinate or coloring (‘c’) as minimal and maximal values of data dat. Parameter add=on
shows that the new range will be joined to existed one (not replace it).
x1 x2 y1 y2 [z1=0 z2=0]
mglGraph
: void
SetRanges (mglPoint
p1, mglPoint
p2)mglGraph
: void
SetRanges (mreal
x1, mreal
x2, mreal
y1, mreal
y2, mreal
z1=0
, mreal
z2=0
)void
mgl_set_ranges (HMGL
gr, mreal
x1, mreal
x2, mreal
y1, mreal
y2, mreal
z1, mreal
z2)Sets the ranges of coordinates. If minimal and maximal values of the coordinate are the same then they are ignored. Also it sets the range for coloring (analogous to crange z1 z2
). This is default color range for 2d plots. Initial ranges are [-1, 1].
mglGraph
: void
SetRanges (const mglDataA &
xx, const mglDataA &
yy)mglGraph
: void
SetRanges (const mglDataA &
xx, const mglDataA &
yy, const mglDataA &
zz)mglGraph
: void
SetRanges (const mglDataA &
xx, const mglDataA &
yy, const mglDataA &
zz, const mglDataA &
cc)Sets the ranges of ‘x’-,‘y’-,‘z’-coordinates and coloring as minimal and maximal values of data xx, yy, zz, cc correspondingly.
x0 y0 [z0=nan]
mglGraph
: void
SetOrigin (mglPoint
p0)mglGraph
: void
SetOrigin (mreal
x0, mreal
y0, mreal
z0=NAN
)void
mgl_set_origin (HMGL
gr, mreal
x0, mreal
y0, mreal
z0)Sets center of axis cross section. If one of values is NAN then MathGL try to select optimal axis position.
x1 x2
x1 y1 x2 y2
x1 y1 z1 x2 y2 z2
x1 y1 z1 c1 x2 y2 z2 c2
mglGraph
: void
ZoomAxis (mglPoint
p1, mglPoint
p2)void
mgl_zoom_axis (HMGL
gr, mreal
x1, mreal
y1, mreal
z1, mreal
c1, mreal
x2, mreal
y2, mreal
z2, mreal
c2)Additionally extend axis range for any settings made by SetRange
or SetRanges
functions according the formula min += (max-min)*p1 and max += (max-min)*p1 (or min *= (max/min)^p1 and max *= (max/min)^p1 for log-axis range when inf>max/min>100 or 0<max/min<0.01). Initial ranges are [0, 1]. Attention! this settings can not be overwritten by any other functions, including DefaultPlotParam()
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mglGraph
: void
SetFunc (const char *
EqX, const char *
EqY, const char *
EqZ=""
, const char *
EqA=""
)void
mgl_set_func (HMGL
gr, const char *
EqX, const char *
EqY, const char *
EqZ, const char *
EqA)Sets transformation formulas for curvilinear coordinate. Each string should contain mathematical expression for real coordinate depending on internal coordinates ‘x’, ‘y’, ‘z’ and ‘a’ or ‘c’ for colorbar. For example, the cylindrical coordinates are introduced as SetFunc("x*cos(y)", "x*sin(y)", "z");
. For removing of formulas the corresponding parameter should be empty or NULL
. Using transformation formulas will slightly slowing the program. Parameter EqA set the similar transformation formula for color scheme. See section Textual formulas.
how
mglGraph
: void
SetCoor (int
how)void
mgl_set_coor (HMGL
gr, 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 coordinates 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; mglLogLog=11
– log-log coordinates x_n=lg(x), y_n=lg(y), z_n=lg(z); mglLogX=12
– log-x coordinates x_n=lg(x), y_n=y, z_n=z; mglLogY=13
– log-y coordinates x_n=x, y_n=lg(y), z_n=z.
val
mglGraph
: void
Ternary (int
tern)void
mgl_set_ternary (HMGL
gr, int
tern)The function sets to draws Ternary (tern=1
), Quaternary (tern=2
) plot or projections (tern=4,5,6
).
Ternary plot is special plot for 3 dependent coordinates (components) a, b, c so that a+b+c=1. MathGL uses only 2 independent coordinates a=x and b=y since it is enough to plot everything. At this third coordinate z act as another parameter to produce contour lines, surfaces and so on.
Correspondingly, Quaternary plot is plot for 4 dependent coordinates a, b, c and d so that a+b+c+d=1. MathGL uses only 3 independent coordinates a=x, b=y and d=z since it is enough to plot everything.
Projections can be obtained by adding value 4
to tern argument. So, that tern=4
will draw projections in Cartesian coordinates, tern=5
will draw projections in Ternary coordinates, tern=6
will draw projections in Quaternary coordinates.
Use Ternary(0)
for returning to usual axis. See section Ternary axis, for sample code and picture. See section Axis projection, for sample code and picture.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mglGraph
: void
Adjust (const char *
dir="xyzc"
)void
mgl_adjust_ticks (HMGL
gr, const char *
dir)Set the ticks step, number of sub-ticks and initial ticks position to be the most human readable for the axis along direction(s) dir. Also set SetTuneTicks(true)
. Usually you don’t need to call this function except the case of returning to default settings.
val [sub=0 org=nan]
val [sub=0 org=nan]
val [sub=0 org=nan]
val [sub=0 org=nan]
mglGraph
: void
SetTicks (char
dir, mreal
d=0
, int
ns=0
, mreal
org=NAN
)void
mgl_set_ticks (HMGL
gr, char
dir, mreal
d, int
ns, mreal
org)Set the ticks step d, number of sub-ticks ns (used for positive d) and initial ticks position org for the axis along direction dir (use ’c’ for colorbar ticks). Variable d set step for axis ticks (if positive) or it’s number on the axis range (if negative). Zero value set automatic ticks. If org value is NAN then axis origin is used.
val1
'lbl1' [val2
'lbl2' ...]val1
'lbl1' [val2
'lbl2' ...]val1
'lbl1' [val2
'lbl2' ...]mglGraph
: void
SetTicksVal (char
dir, const char *
lbl, bool
add=false
)mglGraph
: void
SetTicksVal (char
dir, const wchar_t *
lbl, bool
add=false
)mglGraph
: void
SetTicksVal (char
dir, const mglDataA &
val, const char *
lbl, bool
add=false
)mglGraph
: void
SetTicksVal (char
dir, const mglDataA &
val, const wchar_t *
lbl, bool
add=false
)void
mgl_set_ticks_str (HMGL
gr, char
dir, const char *
lbl, bool
add)void
mgl_set_ticks_wcs (HMGL
gr, char
dir, const wchar_t *
lbl, bool
add)void
mgl_set_ticks_val (HMGL
gr, char
dir, HCDT
val, const char *
lbl, bool
add)void
mgl_set_ticks_valw (HMGL
gr, char
dir, HCDT
val, const wchar_t *
lbl, bool
add)Set the manual positions val and its labels lbl for ticks along axis dir. If array val is absent then values equidistantly distributed in interval [Min.x, Max.x] are used. Labels are separated by ‘\n’ symbol. Use SetTicks()
to restore automatic ticks.
mglGraph
: void
SetTickTempl (char
dir, const char *
templ)mglGraph
: void
SetTickTempl (char
dir, const wchar_t *
templ)void
mgl_set_tick_templ (HMGL
gr, const char *
templ)void
mgl_set_tick_templw (HMGL
gr, const wchar_t *
templ)Set template templ for x-,y-,z-axis ticks or colorbar ticks. It may contain TeX symbols also. If templ=""
then default template is used (in simplest case it is ‘%.2g’). Setting on template switch off automatic ticks tuning.
dv
'tmpl']mglGraph
: void
SetTicksTime (char
dir, mreal
val, const char *
templ)void
mgl_set_ticks_time (HMGL
gr, mreal
val, const char *
templ)Sets time labels with step val and template templ for x-,y-,z-axis ticks or colorbar ticks. It may contain TeX symbols also. The format of template templ is the same as described in http://www.manpagez.com/man/3/strftime/. Most common variants are ‘%X’ for national representation of time, ‘%x’ for national representation of date, ‘%Y’ for year with century. If val=0 and/or templ="" then automatic tick step and/or template will be selected. You can use mgl_get_time
() function for obtaining number of second for given date/time string. Note, that MS Visual Studio couldn’t handle date before 1970.
double
mgl_get_time (const char*
str, const char *
templ)Gets number of seconds from 1970 year to specified date/time str. The format of string is specified by templ, which is the same as described in http://www.manpagez.com/man/3/strftime/. Most common variants are ‘%X’ for national representation of time, ‘%x’ for national representation of date, ‘%Y’ for year with century. Note, that MS Visual Studio couldn’t handle date before 1970.
val
[pos=1.15
]mglGraph
: void
SetTuneTicks (int
tune, mreal
pos=1.15
)void
mgl_tune_ticks (HMGL
gr, int
tune, mreal
pos)Switch on/off ticks enhancing by factoring common multiplier (for small, like from 0.001 to 0.002, or large, like from 1000 to 2000, coordinate values – enabled if tune&1 is nonzero) or common component (for narrow range, like from 0.999 to 1.000 – enabled if tune&2 is nonzero). Also set the position pos of common multiplier/component on the axis: =0 at minimal axis value, =1 at maximal axis value. Default value is 1.15.
mglGraph
: void
SetTickShift (mglPoint
d)void
mgl_set_tick_shift (HMGL
gr, mreal
dx, mreal
dy, mreal
dz, mreal
dc)Set value of additional shift for ticks labels.
mglGraph
: void
SetTickRotate (bool
val)void
mgl_set_tick_rotate (HMGL
gr, bool
val)Enable/disable ticks rotation if there are too many ticks or ticks labels are too long.
mglGraph
: void
SetTickSkip (bool
val)void
mgl_set_tick_skip (HMGL
gr, bool
val)Enable/disable ticks skipping if there are too many ticks or ticks labels are too long.
mglGraph
: void
SetTimeUTC (bool
val)Enable/disable using UTC time for ticks labels. In C/Fortran you can use mgl_set_flag(gr,val, MGL_USE_GMTIME);
.
val
[stt=1
]mglGraph
: void
SetTickLen (mreal
val, mreal
stt=1
)void
mgl_set_tick_len (HMGL
gr, mreal
val, mreal
stt)The relative length of axis ticks. Default value is 0.1
. Parameter stt>0 set relative length of subticks which is in sqrt(1+stt)
times smaller.
mglGraph
: void
SetAxisStl (const char *
stl="k"
, const char *
tck=0
, const char *
sub=0
)void
mgl_set_axis_stl (HMGL
gr, const char *
stl, const char *
tck, const char *
sub)The line style of axis (stl), ticks (tck) and subticks (sub). If stl is empty then default style is used (‘k’ or ‘w’ depending on transparency type). If tck or sub is empty then axis style is used (i.e. stl).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated on May 5, 2014 using texi2html 1.82.