[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.2.1 Subplots
Let me demonstrate possibilities of axes transformation. MathGL has the following functions: SubPlot
, InPlot
, Aspect
and Rotate
(see section Transformation matrix). The order of their calling is strictly determined. First, one changes the position of axes in image area (functions SubPlot
and InPlot
). After that one may rotate the plot (function Rotate
). Finally, one may change aspects of axes (function Aspect
). The following code illustrates the aforesaid it:
int sample(mglGraph *gr, void *) { gr->SubPlot(2,2,0); gr->Box(); gr->Puts(mglPoint(-1,1.1,1),"Just box","rL"); gr->InPlot(0.2,0.5,0.7,1); gr->Box(); gr->Puts(mglPoint(0,1.2,1),"InPlot example"); gr->SubPlot(2,2,1); gr->Rotate(60,40); gr->Aspect(1,1,1); gr->Box(); gr->Puts(mglPoint(1,1,1.5),"Rotate only","rR"); gr->SubPlot(2,2,2); gr->Rotate(60,40); gr->Aspect(1,1,2); gr->Box(); gr->Puts(mglPoint(0,0,2),"Aspect and Rotate"); gr->SubPlot(2,2,3); gr->Rotate(60,40); gr->Aspect(1,2,2); gr->Box(); gr->Puts(mglPoint(0,0,1.5),"Aspect in other direction"); return 0; }
Here I used function Puts
for printing the text in arbitrary position of picture (see section Text printing). Text coordinates and size are connected with axes. However, text coordinates may be everywhere, including the outside the bounding box. I shall show its features later in See section Text printing example.
Example of several subplots on the single picture.