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


3.5.10 Cones sample

Function cones is similar to Bars but draw cones. The sample code is:

int sample(mglGraph *gr)
{
  mglData ys(10,3);   ys.Modify("0.8*sin(pi*(2*x+y/2))+0.2*rnd");
  gr->Light(true);    gr->SetOrigin(0,0,0);
  gr->SubPlot(3,2,0); gr->Title("Cones plot");
  gr->Rotate(50,60);  gr->Box();  gr->Cones(ys);

  gr->SubPlot(3,2,1); gr->Title("2 colors");
  gr->Rotate(50,60);  gr->Box();  gr->Cones(ys,"cbgGyr");

  gr->SubPlot(3,2,2); gr->Title("'#' style");
  gr->Rotate(50,60);  gr->Box();  gr->Cones(ys,"#");

  gr->SubPlot(3,2,3); gr->Title("'a' style");
  gr->SetRange('z',-2,2); // increase range since summation can exceed [-1,1]
  gr->Rotate(50,60);  gr->Box();  gr->Cones(ys,"a");

  gr->SubPlot(3,2,4); gr->Title("'t' style");
  gr->Rotate(50,60);  gr->Box();  gr->Cones(ys,"t");

  gr->SubPlot(3,2,5); gr->Title("'4' style");
  gr->Rotate(50,60);  gr->Box();  gr->Cones(ys,"4");
  return 0;
}
Example of Cones()