TGraphAsymmErrors and Bezier drawing

I have graph like in following example:

[code]{
double x[7], y[7], exl[7], exh[7], eyl[7], eyh[7];

    x[0]=350, y[0]=0.263086, exl[0]=50, exh[0]=50, eyl[0]=0.0105402, eyh[0]=0.0105402;
    x[1]=450, y[1]=0.21118, exl[1]=50, exh[1]=50, eyl[1]=0.00568886, eyh[1]=0.00568886;
    x[2]=550, y[2]=0.220457, exl[2]=50, exh[2]=50, eyl[2]=0.0060389, eyh[2]=0.0060389;
    x[3]=650, y[3]=0.183389, exl[3]=50, exh[3]=50, eyl[3]=0.00421221, eyh[3]=0.00421221;
    x[4]=750, y[4]=0.115308, exl[4]=50, exh[4]=50, eyl[4]=0.00279845, eyh[4]=0.00279845;
    x[5]=850, y[5]=0.0665721, exl[5]=50, exh[5]=50, eyl[5]=0.00184334, eyh[5]=0.00184334;
    x[6]=950, y[6]=0.00812085, exl[6]=50, exh[6]=50, eyl[6]=0.000968385, eyh[6]=0.000968385;

    TGraphAsymmErrors * e = new TGraphAsymmErrors(7, x, y, exl, exh, eyl, eyh);

    e->SetLineColor(2);
    e->SetFillColor(2);

    e->Clone()->Draw("ap4");

    e->SetFillColor(3);
    e->Clone()->Draw("p3,same");

    e->SetFillColor(4);
    e->Clone()->Draw("p5,same");

}[/code]
If you run it, you will see that for option 4 the last bin is overdrawn. I know that it comes from Bezier curve calculations, but is there any trick how to avoid such artefacts?

No, it cannot be avoid in your case. Use 3 it looks much better.

Indeed, “3” looks better. But I found simple trick to fix the problem, just by adding one dummy point. Trick is shown in this modified example. I leave it here for completeness, maybe someone else will find it useful.

[code]
{
double x[7], y[7], exl[7], exh[7], eyl[7], eyh[7];

    x[0]=350, y[0]=0.263086, exl[0]=50, exh[0]=50, eyl[0]=0.0105402, eyh[0]=0.0105402;
    x[1]=450, y[1]=0.21118, exl[1]=50, exh[1]=50, eyl[1]=0.00568886, eyh[1]=0.00568886;
    x[2]=550, y[2]=0.220457, exl[2]=50, exh[2]=50, eyl[2]=0.0060389, eyh[2]=0.0060389;
    x[3]=650, y[3]=0.183389, exl[3]=50, exh[3]=50, eyl[3]=0.00421221, eyh[3]=0.00421221;
    x[4]=750, y[4]=0.115308, exl[4]=50, exh[4]=50, eyl[4]=0.00279845, eyh[4]=0.00279845;
    x[5]=850, y[5]=0.0665721, exl[5]=50, exh[5]=50, eyl[5]=0.00184334, eyh[5]=0.00184334;
    x[6]=950, y[6]=0.00812085, exl[6]=50, exh[6]=50, eyl[6]=0.000968385, eyh[6]=0.000968385;

    TGraphAsymmErrors * e = new TGraphAsymmErrors(7, x, y, exl, exh, eyl, eyh);

    e->SetLineColor(2);
    e->SetFillColor(2);

    e->Clone()->Draw("ap3");

    e->SetFillColor(3);
    e->Clone()->Draw("p4,same");

    e->SetFillColor(4);
    e->Clone()->Draw("p5,same");

    // trick is in the next line, adds dummy point, but modifies curvature between first two points of the graphs
    e->Set(e->GetN()+1);
    e->SetFillColor(6);
    e->SetFillStyle(3001);
    e->Clone()->Draw("p4,same");

}[/code]

Yes … sorry I forgot to mention it … but as you said it is a trick … and not always practical …