Re: Filled TPolyLines

Rene Brun (Rene.Brun@cern.ch)
Thu, 04 Jun 1998 17:41:36 +0200


Norbert Danneberg wrote:
>
> Hi,
> how can I draw filled (colored) TPolyLine ?
> The solution I tried draws only the line,
> no color-filled area.
>
> {
> gROOT->Reset();
> Float_t x[7] = {0.2,0.3,0.3,0.2,0.1,0.1,0.2};
> Float_t y[7] = {0.4,0.3,0.2,0.1,0.2,0.3,0.4};
> TPolyLine *pl1 = new TPolyLine(7,x,y);
> pl1.SetFillColor(6);
> pl1.SetFillStyle(3008);
> pl1.Draw();
> }
>

The class TPolyLine does not include the functions to color
the filled area. This functionality is part of the TGraph class.
I have modified your macro accordingly.

Rene Brun

{
gROOT->Reset();
Float_t x[7] = {0.2,0.3,0.3,0.2,0.1,0.1,0.2};
Float_t y[7] = {0.4,0.3,0.2,0.1,0.2,0.3,0.4};
TGraph *gr = new TGraph(7,x,y);
gr->SetFillColor(6);
gr->SetFillStyle(3008);
gr->Draw("f");
}