Next: ContV sample, Previous: ContF sample, Up: 2D samples [Contents][Index]
Function contd is similar to ContF
but with manual contour colors. The sample code is:
int sample(mglGraph *gr) { mglData a,v(5),a1(30,40,3); mgls_prepare2d(&a); v.a[0]=-0.5; v.a[1]=-0.15; v.a[2]=0; v.a[3]=0.15; v.a[4]=0.5; gr->SubPlot(2,2,0); gr->Title("ContD plot (default)"); gr->Rotate(50,60); gr->Box(); gr->ContD(a); gr->SubPlot(2,2,1); gr->Title("manual levels"); gr->Rotate(50,60); gr->Box(); gr->ContD(v,a); gr->SubPlot(2,2,2); gr->Title("'\\_' style"); gr->Rotate(50,60); gr->Box(); gr->ContD(a,"_"); gr->Fill(a1,"0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)"); gr->SubPlot(2,2,3); gr->Title("several slices"); gr->Rotate(50,60); gr->Box(); gr->ContD(a1); return 0; }