Hi Joakim, Use a TGraph instead of TPolyLine. See macro below: Rene Brun { gROOT->Reset(); TCanvas *mycanvas = new TCanvas("mycanvas", "My Canvas",400,10,800,800); Int_t NPoints = 4; Float_t X[4]; X[0]=0.35; X[1]=0.45; X[2]=0.55; X[3]=0.35; Float_t Y[4]; Y[0]=0.4; Y[1]=0.6; Y[2]=0.4; Y[3]=0.4; TGraph *plin = new TGraph(NPoints,X,Y); plin->SetLineColor(3); //green plin->SetLineWidth(2); plin->SetFillColor(4); //blue plin->Draw("af"); //draw with Axis and Fill plin->Draw("l"); //draw only the contour Line } On Sun, 30 Jan 2000, Joakim Nystrand wrote: > > Hi, > > Can one create and fill a polygon in root? I have tried to use > TPolyLine the following way but it doesn't seem to work: > > TCanvas *mycanvas = new TCanvas("mycanvas", "My Canvas",400,10,800,800); > Int_t NPoints = 4; > Float_t X[4]; X[0]=0.35; X[1]=0.45; X[2]=0.55; X[3]=0.35; > Float_t Y[4]; Y[0]=0.4; Y[1]=0.6; Y[2]=0.4; Y[3]=0.4; > TPolyLine *plin = new TPolyLine(NPoints,X,Y); > plin->SetLineColor(3); //green > plin->SetLineWidth(2); > plin->SetFillColor(4); //blue > plin->Draw(); > > It seems that the SetFillColor(4) has no effect. Is this a bug, or is this > functionality not there (can it be put in?), or am I doing something > wrong. Grateful for help. > > Joakim Nystrand >
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:18 MET