I am trying to remove the x-axis error bars from a TGraphAsymmErrors object. I have tried using: gStyle->SetErrorX(0) and it doesn’t work for TGraphAsymmErrors. I cannot use an array of 0’s when initializing, because I initialize using the Divide. The initializing is below:
TGraphAsymmErrors* graph = new TGraphAsymmErrors(30);
I cannot find how to then get rid of the x-axis error bars. They are fairly useless, since it’s simply the histogram bin width. Any idea how to remove these?
TGraphAsymmErrors displays the errors you passed as parameters… Set them to 0 if you do not want to see them.
The TGraphPainter description for TGraphErrors, TGraphAsymmErrors and TGraphBentErrors explicitly claims:
"gStyle->SetErrorX(dx) controls the size of the error along x. dx = 0 removes the error along x."
I checked that this is NOT true for TGraphErrors nor TGraphAsymmErrors (I did NOT check TGraphBentErrors).
Yes because for those the errors are user’s defined … there no automatic way like the errors on X for histograms.
If you want to remove them set them to 0 when you create the TGraphAsymmErrors.
So, maybe improve / correct the message which actually claims that you can “remove” X errors from plots just by setting “gStyle->SetErrorX(0);”.
The problem here is that to provide the errors you also have to provide the x, y, and dy points. I don’t do this, since I use the Divide function to fill the TGraphAsymmErrors. I couldn’t find a way to initialize only the dx points, so I was trying to find some way to set the x-errors to 0 after doing the Divide function.
you can loop on:
root.cern.ch/doc/master/classTG … 9e016ce5eb[/quote]
Perfect, Thanks. This did it.