Function vect is most standard way to visualize vector fields – it draw a lot of arrows or hachures for each data cell. It have a lot of options which can be seen on the figure (and in the sample code), and use color scheme for coloring (see Color scheme).
MGL code:
call 'prepare2v' call 'prepare3v' subplot 3 2 0 '':title 'Vect plot (default)':box:vect a b subplot 3 2 1 '':title '"." style; "=" style':box:vect a b '.=' subplot 3 2 2 '':title '"f" style':box:vect a b 'f' subplot 3 2 3 '':title '">" style':box:vect a b '>' subplot 3 2 4 '':title '"<" style':box:vect a b '<' subplot 3 2 5:title '3d variant':rotate 50 60:box:vect ex ey ez
C++ code:
void smgl_vect3(mglGraph *gr) { mglData ex,ey,ez; mgls_prepare3v(&ex,&ey,&ez); if(big!=3) { gr->SubPlot(2,1,0); gr->Title("Vect3 sample"); } gr->Rotate(50,60); gr->SetOrigin(0,0,0); gr->Axis("_xyz"); gr->Box(); gr->Vect3(ex,ey,ez,"x"); gr->Vect3(ex,ey,ez); gr->Vect3(ex,ey,ez,"z"); if(big==3) return; gr->SubPlot(2,1,1); gr->Title("'f' style"); gr->Rotate(50,60); gr->SetOrigin(0,0,0); gr->Axis("_xyz"); gr->Box(); gr->Vect3(ex,ey,ez,"fx"); gr->Vect3(ex,ey,ez,"f"); gr->Vect3(ex,ey,ez,"fz"); gr->Grid3(ex,"Wx"); gr->Grid3(ex,"W"); gr->Grid3(ex,"Wz"); }