[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.5.6 Region sample
Function region fill the area between 2 curves. It support gradient filling if 2 colors per curve is specified. Also it can fill only the region y1<y<y2 if style ‘i’ is used. The sample code is:
int sample(mglGraph *gr) { mglData y; mgls_prepare1d(&y); mglData y1 = y.SubData(-1,1), y2 = y.SubData(-1,2); gr->SetOrigin(0,0,0); gr->SubPlot(2,2,0,""); gr->Title("Region plot (default)"); gr->Box(); gr->Region(y1,y2); gr->Plot(y1,"k2"); gr->Plot(y2,"k2"); gr->SubPlot(2,2,1,""); gr->Title("2 colors"); gr->Box(); gr->Region(y1,y2,"yr"); gr->Plot(y1,"k2"); gr->Plot(y2,"k2"); gr->SubPlot(2,2,2,""); gr->Title("'!' style"); gr->Box(); gr->Region(y1,y2,"!"); gr->Plot(y1,"k2"); gr->Plot(y2,"k2"); gr->SubPlot(2,2,3,""); gr->Title("'i' style"); gr->Box(); gr->Region(y1,y2,"ir"); gr->Plot(y1,"k2"); gr->Plot(y2,"k2"); return 0; }
This document was generated on March 21, 2014 using texi2html 5.0.