TGraphErrors Drawing Option (Fill Area)

Hi,

I would like to draw a fill area under a TGraphErrors. I found in the documentation that this can be achieved by the drawing option “F”. Unfortunately, the result does not look like expected. Instead of drawing a fill area underneath the whole graph (meaning between the points and the x-axis), ROOT connects the first and the last point and only fills the area in between (see attached plot). Does anyone have a suggestion how to get the fill area I would like? (I could add an additional point at (0,100) but that would only be a “dirty” workaround.)

At the moment I am using:
if (iem==0) graph->Draw(“APF”);
else graph->Draw(“PFsame”);

Thanks in advance!

Petra
plotgraphs.pdf (15.3 KB)

Yes this is how it is implemented, do:

{
   TCanvas *c1 = new TCanvas("c1","",200,10,700,500);
   const Int_t n = 10;
   Double_t x[n+1], y[n+1];
   for (Int_t i=0;i<n;i++) {
     x[i] = i*0.1;
     y[i] = 10*sin(x[i]+0.2);
   }
   x[n] = x[n-1];
   y[n] = y[0];
   gr = new TGraph(n+1,x,y);
   gr->Draw("AF");
}