These functions control how and where further plotting will be placed. There is a certain calling order of these functions for the better plot appearance. First one should be subplot, multiplot or inplot for specifying the place. Second one can be title for adding title for the subplot. After it a rotate, shear and aspect. And finally any other plotting functions may be called. Alternatively you can use columnplot, gridplot, stickplot, shearplot or relative inplot for positioning plots in the column (or grid, or stick) one by another without gap between plot axis (bounding boxes). See Subplots, for sample code and picture.
nx ny m
['stl'='<>_^' dx=0 dy=0
]
¶mglGraph
: void
SubPlot (int
nx, int
ny, int
m, const char *
stl="<>_^"
, mreal
dx=0
, mreal
dy=0
)
¶void
mgl_subplot (HMGL
gr, int
nx, int
ny, int
m, const char *
stl)
¶void
mgl_subplot_d (HMGL
gr, int
nx, int
ny, int
m, const char *
stl, mreal
dx, mreal
dy)
¶Puts further plotting in a m-th cell of nx*ny grid of the whole frame area. The position of the cell can be shifted from its default position by relative size dx, dy. This function set off any aspects or rotations. So it should be used first for creating the subplot. Extra space will be reserved for axis/colorbar if stl contain:
From the aesthetical point of view it is not recommended to use this function with different matrices in the same frame. Note, colorbar can be invisible (be out of image borders) if you set empty style ‘’.
nx ny m dx dy
['style'='<>_^' sx sy]
¶mglGraph
: void
MultiPlot (int
nx, int
ny, int
m, int
dx, int
dy, const char *
stl="<>_^"
)
¶void
mgl_multiplot (HMGL
gr, int
nx, int
ny, int
m, int
dx, int
dy, const char *
stl)
¶Puts further plotting in a rectangle of dx*dy cells starting from m-th cell of nx*ny grid of the whole frame area. The position of the rectangular area can be shifted from its default position by relative size sx, sy. This function set off any aspects or rotations. So it should be used first for creating subplot. Extra space will be reserved for axis/colorbar if stl contain:
x1 x2 y1 y2 [rel=on]
¶mglGraph
: void
InPlot (mreal
x1, mreal
x2, mreal
y1, mreal
y2, bool
rel=true
)
¶void
mgl_inplot (HMGL
gr, mreal
x1, mreal
x2, mreal
y1, mreal
y2)
¶void
mgl_relplot (HMGL
gr, mreal
x1, mreal
x2, mreal
y1, mreal
y2)
¶Puts further plotting in some region of the whole frame surface. This function allows one to create a plot in arbitrary place of the screen. The position is defined by rectangular coordinates [x1, x2]*[y1, y2]. The coordinates x1, x2, y1, y2 are normalized to interval [0, 1]. If parameter rel=true
then the relative position to current subplot (or inplot with rel=false
) is used. This function set off any aspects or rotations. So it should be used first for creating subplot.
num ind [d=0]
¶mglGraph
: void
ColumnPlot (int
num, int
ind, mreal
d=0
)
¶void
mgl_columnplot (HMGL
gr, int
num, int
ind)
¶void
mgl_columnplot_d (HMGL
gr, int
num, int
ind, mreal
d)
¶Puts further plotting in ind-th cell of column with num cells. The position is relative to previous subplot (or inplot with rel=false
). Parameter d set extra gap between cells.
nx ny ind [d=0]
¶mglGraph
: void
GridPlot (int
nx, int
ny, int
ind, mreal
d=0
)
¶void
mgl_gridplot (HMGL
gr, int
nx, int
ny, int
ind)
¶void
mgl_gridplot_d (HMGL
gr, int
nx, int
ny, int
ind, mreal
d)
¶Puts further plotting in ind-th cell of nx*ny grid. The position is relative to previous subplot (or inplot with rel=false
). Parameter d set extra gap between cells.
num ind tet phi
¶mglGraph
: void
StickPlot (int
num, int
ind, mreal
tet, mreal
phi)
¶void
mgl_stickplot (HMGL
gr, int
num, int
ind, mreal
tet, mreal
phi)
¶Puts further plotting in ind-th cell of stick with num cells. At this, stick is rotated on angles tet, phi. The position is relative to previous subplot (or inplot with rel=false
).
num ind sx sy [xd yd]
¶mglGraph
: void
ShearPlot (int
num, int
ind, mreal
sx, mreal
sy, mreal
xd=1
, mreal
yd=0
)
¶void
mgl_shearplot (HMGL
gr, int
num, int
ind, mreal
sx, mreal
sy, mreal
xd, mreal
yd)
¶Puts further plotting in ind-th cell of stick with num cells. At this, cell is sheared on values sx, sy. Stick direction is specified be xd and yd. The position is relative to previous subplot (or inplot with rel=false
).
'title' ['stl'='' size=-2
]
¶mglGraph
: void
Title (const char *
txt, const char *
stl=""
, mreal
size=-2
)
¶mglGraph
: void
Title (const wchar_t *
txt, const char *
stl=""
, mreal
size=-2
)
¶void
mgl_title (HMGL
gr, const char *
txt, const char *
stl, mreal
size)
¶void
mgl_titlew (HMGL
gr, const wchar_t *
txt, const char *
stl, mreal
size)
¶Add text title for current subplot/inplot. Parameter stl can contain:
Parameter size set font size. This function set off any aspects or rotations. So it should be used just after creating subplot. Note, that each call of this command will reserve extra space. So, you need to manually call subplot command after rasterize if you want to combine bitmap and vector graphics.
tetx tetz [tety=0]
¶mglGraph
: void
Rotate (mreal
TetX, mreal
TetZ, mreal
TetY=0
)
¶void
mgl_rotate (HMGL
gr, mreal
TetX, mreal
TetZ, mreal
TetY)
¶Rotates a further plotting relative to each axis {x, z, y} consecutively on angles TetX, TetZ, TetY.
tet x y z
¶mglGraph
: void
RotateN (mreal
Tet, mreal
x, mreal
y, mreal
z)
¶void
mgl_rotate_vector (HMGL
gr, mreal Tet
, mreal x
, mreal y
, mreal z
)
¶Rotates a further plotting around vector {x, y, z} on angle Tet.
sx sy
¶mglGraph
: void
Shear (mreal
sx, mreal
sy)
¶void
mgl_shear (HMGL
gr, mreal
sx, mreal
sy)
¶Shears a further plotting on values sx, sy.
ax ay [az=1]
¶mglGraph
: void
Aspect (mreal
Ax, mreal
Ay, mreal
Az=1
)
¶void
mgl_aspect (HMGL
gr, mreal
Ax, mreal
Ay, mreal
Az)
¶Defines aspect ratio for the plot. The viewable axes will be related one to another as the ratio Ax:Ay:Az. For the best effect it should be used after rotate function. If Ax is NAN
then function try to select optimal aspect ratio to keep equal ranges for x-y axis. At this, Ay will specify proportionality factor, or set to use automatic one if Ay=NAN
.
mglGraph
: void
Push ()
¶void
mgl_mat_push (HMGL
gr)
¶Push transformation matrix into stack. Later you can restore its current state by Pop() function.
mglGraph
: void
Pop ()
¶void
mgl_mat_pop (HMGL
gr)
¶Pop (restore last ’pushed’) transformation matrix into stack.
mglGraph
: void
SetPlotFactor (mreal
val)
¶void
mgl_set_plotfactor (HMGL
gr, mreal
val)
¶Sets the factor of plot size. It is not recommended to set it lower then 1.5. This is some analogue of function Zoom() but applied not to overall image but for each InPlot. Use negative value or zero to enable automatic selection.
There are 3 functions View()
, Zoom()
and Perspective()
which transform whole image. I.e. they act as secondary transformation matrix. They were introduced for rotating/zooming the whole plot by mouse. It is not recommended to call them for picture drawing.
val
¶mglGraph
: void
Perspective (mreal
a)
¶void
mgl_perspective (HMGL
gr, mreal
a)
¶Add (switch on) the perspective to plot. The parameter a = Depth/(Depth+dz) \in [0,1). By default (a=0
) the perspective is off.
tetx tetz [tety=0]
¶mglGraph
: void
View (mreal
TetX, mreal
TetZ, mreal
TetY=0
)
¶void
mgl_view (HMGL
gr, mreal
TetX, mreal
TetZ, mreal
TetY)
¶Rotates a further plotting relative to each axis {x, z, y} consecutively on angles TetX, TetZ, TetY. Rotation is done independently on rotate. Attention! this settings can not be overwritten by DefaultPlotParam()
. Use Zoom(0,0,1,1)
to return default view.
x1 y1 x2 y2
¶mglGraph
(C++, Python): void
Zoom (mreal
x1, mreal
y1, mreal
x2, mreal
y2)
¶void
mgl_set_zoom (HMGL
gr, mreal
x1, mreal
y1, mreal
x2, mreal
y2)
¶The function changes the scale of graphics that correspond to zoom in/out of the picture. After function call the current plot will be cleared and further the picture will contain plotting from its part [x1,x2]*[y1,y2]. Here picture coordinates x1, x2, y1, y2 changes from 0 to 1. Attention! this settings can not be overwritten by any other functions, including DefaultPlotParam()
. Use Zoom(0,0,1,1)
to return default view.