Problem with TGraphError: err bars for points outside range

TGraphError doesn’t seem to want to draw error bars for data points outside the x or y-axis limits. Does anyone know of a way to get around this?

Here is example code to reproduce the problem:

{
float x[]={1,2,3};
float err_x[]={0,0,0};
float err_y[]={5,5,5};
float y[]={1,4,9};
TGraphErrors tg(3,x,y,err_x,err_y);
tg.GetXaxis().SetLimits(0,4);
tg.SetMaximum(8);
tg.SetMinimum(0);
tg.SetMarkerStyle(25);
tg.Draw(“AP”);
}

In the above code, the error bars for the third data point should be visible. If you change the ‘tg.SetMaximum(8)’ to ‘tg.SetMaximum(10)’ you will see both the data point and the error.

Here is some context:
I need to plot data points for which a few go off to (nearly) infinity. Setting the y-axis limits large enough to include those points would make the scale too large for the rest of the data points. Yet setting the y-axis limits to not include those data points makes their large errors (which otherwise would extend into the chosen y-axis range) to disappear.

Any help would be appreciated!

Thanks,
Orin

When you set the Y maximum to 8, the 3rd data point is outside the limits (y=9) and therefore all the data regarding this points are clipped (the data point and the error bars). Should the errors bars be visible in that case ? … I am not sure…
May be you should plot in log scales ?

Right – I do not want the data regarding these points to be clipped. In my situation the error bars should be visible, although I expect this may be a rare situation. A log scale would not be appropriate for the context in which this problem occurs, unfortunately.

In that case I think a new drawing option should be created for TGraphErrors…