Example of parametric plots for 3D data.
MGL code:
new x 50 50 50 '(x+2)/3*sin(pi*y/2)' new y 50 50 50 '(x+2)/3*cos(pi*y/2)' new z 50 50 50 'z' new c 50 50 50 '-2*(x^2+y^2+z^4-z^2)+0.2' new d 50 50 50 '1-2*tanh(2*(x+y)^2)' alpha on:light on subplot 4 3 0:rotate 40 60:box:surf3 x y z c subplot 4 3 1:rotate 40 60:box:surf3c x y z c d subplot 4 3 2:rotate 40 60:box:surf3a x y z c d subplot 4 3 3:rotate 40 60:box:cloud x y z c subplot 4 3 4:rotate 40 60:box:cont3 x y z c:cont3 x y z c 'x':cont3 x y z c 'z' subplot 4 3 5:rotate 40 60:box:contf3 x y z c:contf3 x y z c 'x':contf3 x y z c 'z' subplot 4 3 6:rotate 40 60:box:dens3 x y z c:dens3 x y z c 'x':dens3 x y z c 'z' subplot 4 3 7:rotate 40 60:box:dots x y z c;meshnum 15 subplot 4 3 8:rotate 40 60:box:densx c '' 0:densy c '' 0:densz c '' 0 subplot 4 3 9:rotate 40 60:box:contx c '' 0:conty c '' 0:contz c '' 0 subplot 4 3 10:rotate 40 60:box:contfx c '' 0:contfy c '' 0:contfz c '' 0
C++ code:
void smgl_param3(mglGraph *gr) // 3d parametric plots { mglData x(50,50,50), y(50,50,50), z(50,50,50), c(50,50,50), d(50,50,50); gr->Fill(x,"(x+2)/3*sin(pi*y/2)"); gr->Fill(y,"(x+2)/3*cos(pi*y/2)"); gr->Fill(z,"z"); gr->Fill(c,"-2*(x^2+y^2+z^4-z^2)+0.2"); gr->Fill(d,"1-2*tanh(2*(x+y)^2)"); gr->Light(true); gr->Alpha(true); gr->SubPlot(4,3,0); gr->Rotate(40,60); gr->Box(); gr->Surf3(x,y,z,c); gr->SubPlot(4,3,1); gr->Rotate(40,60); gr->Box(); gr->Surf3C(x,y,z,c,d); gr->SubPlot(4,3,2); gr->Rotate(40,60); gr->Box(); gr->Surf3A(x,y,z,c,d); gr->SubPlot(4,3,3); gr->Rotate(40,60); gr->Box(); gr->Cloud(x,y,z,c); gr->SubPlot(4,3,4); gr->Rotate(40,60); gr->Box(); gr->Cont3(x,y,z,c); gr->Cont3(x,y,z,c,"x"); gr->Cont3(x,y,z,c,"z"); gr->SubPlot(4,3,5); gr->Rotate(40,60); gr->Box(); gr->ContF3(x,y,z,c);gr->ContF3(x,y,z,c,"x");gr->ContF3(x,y,z,c,"z"); gr->SubPlot(4,3,6); gr->Rotate(40,60); gr->Box(); gr->Dens3(x,y,z,c); gr->Dens3(x,y,z,c,"x"); gr->Dens3(x,y,z,c,"z"); gr->SubPlot(4,3,7); gr->Rotate(40,60); gr->Box(); gr->Dots(x,y,z,c,"","meshnum 15"); gr->SubPlot(4,3,8); gr->Rotate(40,60); gr->Box(); gr->DensX(c,"",0); gr->DensY(c,"",0); gr->DensZ(c,"",0); gr->SubPlot(4,3,9); gr->Rotate(40,60); gr->Box(); gr->ContX(c,"",0); gr->ContY(c,"",0); gr->ContZ(c,"",0); gr->SubPlot(4,3,10);gr->Rotate(40,60); gr->Box(); gr->ContFX(c,"",0); gr->ContFY(c,"",0); gr->ContFZ(c,"",0); }