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


3.5.9 Barh sample

Function barh is the similar to Bars but draw horizontal bars. 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->SetOrigin(0,0,0);
  gr->SubPlot(2,2,0,"");  gr->Title("Barh plot (default)");
  gr->Box();  gr->Barh(ys);

  gr->SubPlot(2,2,1,"");  gr->Title("2 colors");
  gr->Box();  gr->Barh(ys,"cbgGyr");

  gr->SetRanges(-3,3,-1,1);
  gr->SubPlot(2,2,2,"");  gr->Title("'a' style");
  gr->Box();  gr->Barh(ys,"a");

  gr->SubPlot(2,2,3,"");  gr->Title("'f' style");
  gr->Box();  gr->Barh(ys,"f");
  return 0;
}
Example of Barh()