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