Function flow is another standard way to visualize vector fields – it draw lines (threads) which is tangent to local vector field direction. MathGL draw threads from edges of bounding box and from central slices. Sometimes it is not most appropriate variant – you may want to use flowp
to specify manual position of threads. The color scheme is used for coloring (see Цветовая схема). At this warm color corresponds to normal flow (like attractor), cold one corresponds to inverse flow (like source).
MGL code:
call 'prepare2v' call 'prepare3v' subplot 2 2 0 '':title 'Flow plot (default)':box:flow a b subplot 2 2 1 '':title '"v" style':box:flow a b 'v' subplot 2 2 2 '':title '"#" and "." styles':box:flow a b '#':flow a b '.2k' subplot 2 2 3:title '3d variant':rotate 50 60:box:flow ex ey ez
C++ code:
void smgl_flow(mglGraph *gr) { mglData a,b; mgls_prepare2v(&a,&b); if(big!=3) {gr->SubPlot(2,2,0,""); gr->Title("Flow plot (default)");} gr->Box(); gr->Flow(a,b); if(big==3) return; gr->SubPlot(2,2,1,""); gr->Title("'v' style"); gr->Box(); gr->Flow(a,b,"v"); gr->SubPlot(2,2,2,""); gr->Title("'\\#' and '.' styles"); gr->Box(); gr->Flow(a,b,"#"); gr->Flow(a,b,".2k"); mglData ex,ey,ez; mgls_prepare3v(&ex,&ey,&ez); gr->SubPlot(2,2,3); gr->Title("3d variant"); gr->Rotate(50,60); gr->Box(); gr->Flow(ex,ey,ez); }