Next: , Previous: , Up: 2D samples   [Contents][Index]


3.6.13 ContF sample

Function contf draw filled contours. You can select automatic (default) or manual levels for contours. 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("ContF plot (default)");
  gr->Rotate(50,60);  gr->Box();  gr->ContF(a);

  gr->SubPlot(2,2,1); gr->Title("manual levels");
  gr->Rotate(50,60);  gr->Box();  gr->ContF(v,a);

  gr->SubPlot(2,2,2); gr->Title("'\\_' style");
  gr->Rotate(50,60);  gr->Box();  gr->ContF(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->ContF(a1);
  return 0;
}
Example of ContF()