Draw option e4 for graphs

The “e4” draw option doesn’t seem to work correctly for graphs, it seems to result in a very unsual fill. I’ve attached the output I get as a gif file (left pad option is “e3”, whereas “e4” is used for the right one).

My entire macro:

void graph()
{

  TH1D* h1 = new TH1D("h1","h1",5,0,10);

  for(int i=1; i<=5; i++)
    {
      double num = i-3.5;
      h1->SetBinContent(i, exp(i));
    }

  TGraphAsymmErrors* g1 = new TGraphAsymmErrors(h1);
  TGraph* g2 = new TGraph(h1);
  TMultiGraph* m1 = new TMultiGraph("m1","m1");
  TMultiGraph* m2 = new TMultiGraph("m2","m2");

  for(int j=1; j<=5; j++)
    {
      int point = j-1;

      double num1 = 0.5*h1->GetBinContent(j);
      double num2 = 1.0*h1->GetBinContent(j);

      g1->SetPointError(point,0.0,0.0,num1,num2);
    }

  g1->SetFillColor(2);
  g2->SetLineColor(1);

  m1->SetMinimum(-100.0);
  m1->SetMaximum(500.0);
  m1->SetTitle("e3 option");
  m1->Add(g1,"e3");
  m1->Add(g2,"l");

  m2->SetMinimum(-100.0);
  m2->SetMaximum(500.0);
  m2->SetTitle("e4 option");
  m2->Add(g1,"e4");
  m2->Add(g2,"c");

  TCanvas* c1 = new TCanvas("c1","c1",10,10,900,600);
  c1->Divide(2,1);

  c1->cd(1);
  m1->Draw("a");

  c1->cd(2);
  m2->Draw("a");

  c1->Print("c1.gif");
}


Your macro is not complete. I tried to make one reproducing the problem. For me it is ok:

{
   gROOT->Reset();
   c1 = new TCanvas("c1","A Simple GraphErrors Example",200,10,700,500);
   const Int_t n = 20;
   Double_t x[n], y[n], ex[n], ey[n];
   for (Int_t i=0;i<n;i++) {
     x[i]  = i*0.1;
     y[i]  = 10*sin(x[i]+0.2);
     ex[i] = 0.08;
     ey[i] = 0.1*i;
   }
   gr = new TGraphErrors(n,x,y,ex,ey);
   gr->Draw("A l E4");
}

I’ve now editted my first post to include my whole macro. I tried changing the TGraphErrors graph to a TGraphAsymmErrors one and got what appears to be a similar problem.

Try running my macro and post the plots you get.

I see now. you should not use E4 for this kind of graph. E4 does a smoothing which, in case of very sharp transition (veritcal line in your case), produces this “bouncing effect”. There is no work around, this smoothing algorithm is that way. Use E3 instead.