Next: Tens sample, Previous: Radar sample, Up: 1D samples [Contents][Index]
Function step plot data as stairs. It have the same options as Plot
. The sample code is:
int sample(mglGraph *gr) { mglData y; mgls_prepare1d(&y); gr->SetOrigin(0,0,0); mglData yc(30), xc(30), z(30); z.Modify("2*x-1"); yc.Modify("sin(pi*(2*x-1))"); xc.Modify("cos(pi*2*x-pi)"); gr->SubPlot(2,2,0,""); gr->Title("Step plot (default)"); gr->Box(); gr->Step(y); gr->SubPlot(2,2,1); gr->Title("3d variant"); gr->Rotate(50,60); gr->Box(); gr->Step(xc,yc,z,"r"); gr->SubPlot(2,2,2,""); gr->Title("'!' style"); gr->Box(); gr->Step(y,"s!rgb"); return 0; }