Laurent Aphecetche wrote: > Hi, > > I have a canvas with a TPolyLine inside. > I would like to fill it. > > root [0] Float_t x[4] = { 0.1,0.5,0.25,0.1} > root [1] Float_t y[4] = { 0.1,0.1,0.25,0.1} > root [2] TCanvas* c2 = new TCanvas("c2","coucou",400,400); > root [3] TPolyLine* l = new TPolyLine(4,x,y) ; > root [4] l->SetFillStyle(1001) ; > root [5] l->SetFillColor(2) ; > root [6] l->Draw() ; > > The line is not filled at all ! > What am I doing wrong ? > > (the final objective is to modify the line once it has been drawed. Is > this possible ?) The class TPolyLine does not support fill areas. Use TGraph instead. See macro below. { gROOT->Reset(); Float_t x[4] = { 0.1,0.5,0.25,0.1}; Float_t y[4] = { 0.1,0.1,0.25,0.1}; TCanvas* c2 = new TCanvas("c2","coucou",400,400); // TPolyLine* l = new TPolyLine(4,x,y) ; TGraph* l = new TGraph(4,x,y) ; l->SetFillStyle(1001) ; l->SetFillColor(2) ; l->Draw("f") ; } Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:22 MET