manpagez: man pages & more
info mathgl_en
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.5.5 Area sample

Function area fill the area between curve and axis plane. It support gradient filling if 2 colors per curve is specified. The sample code is:

int sample(mglGraph *gr)
{
  mglData y;  mgls_prepare1d(&y); gr->SetOrigin(0,0,0);
  gr->SubPlot(2,2,0,"");  gr->Title("Area plot (default)");
  gr->Box();  gr->Area(y);

  gr->SubPlot(2,2,1,"");  gr->Title("2 colors");
  gr->Box();  gr->Area(y,"cbgGyr");

  gr->SubPlot(2,2,2,"");  gr->Title("'!' style");
  gr->Box();  gr->Area(y,"!");

  gr->SubPlot(2,2,3); gr->Title("3d variant");
  gr->Rotate(50,60);  gr->Box();
  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->Area(xc,yc,z,"r");
  yc.Modify("-sin(pi*(2*x-1))");  gr->Area(xc,yc,z,"b#");
  return 0;
}
Example of Area()

This document was generated on March 21, 2014 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.