Problem with error bands in TGraphErrors

This is to report a probable bug in TGraphErrors plotted with the “4” option (ROOT 5.26)

{ double x[3] = { 1,2,3 }; double y[3] = { 1,2,1 }; double ey[3] = { 0.1,0.2,0.1 }; TGraphErrors graph(3,x,y,0,ey); graph.SetFillColor(kGray); graph.Draw("A4"); graph.Draw("CPsame"); }

As you can see the error band is getting it wrong on the last point. A work-around seems to be to add a point overlapping the last one.

{ double x[4] = { 1,2,3,3 }; double y[4] = { 1,2,1,1 }; double ey[4] = { 0.1,0.2,0.1,0.1 }; TGraphErrors graph(4,x,y,0,ey); graph.SetFillColor(kGray); graph.Draw("A4"); graph.Draw("CPsame"); }

– Gregory

This is a known feature explained here, and there.

Thanks for the quick answer, I found this information in the mean time as you were answering me. I think the workaround I am proposing might still be useful to get rid of the “algorithm artifact effect” on the last points. Maybe a more elegant solution can be found out for future ROOT releases.

– Gregory

It needs to be tested with several case. I might depends on the data set. I am not sure it will work with the example shown on the pages I sent you. To be tried.