Lower error bars in TGraphAsymmErrors aren't printed

I have a problem with my TGraphAsymmErrors.
In a macro, I create an empty graph with asymmetrical error bars and fill it with one value for each of other files, in a loop. I summed it up in the following (pseudo)code:

TCanvas* canvas=new TCanvas( "blah");
TGraphAsymmErrors* savedgraph=new TGraphAsymmErrors();

begin loop(over iLoop){
  TFile* file=TFile::Open( Form("%s%", FILE.Data(), ILOOP.Data()) );
  TGraphAsymmErrors* loadedgraph=(TGraphAsymmErrors*)file->Get( "graphname" );`
  double x   = xarray[iLoop];
  double y   = loadedgraph->GetY()[0];
  double ylow= loadedgraph->GetErrorYlow(0);
  double yhig= loadedgraph->GetErrorYhigh(0);

  savedgraph->SetPoint(     iLoop, x, y);
  savedgraph->SetPointError(iLoop, 0, 0, ylow, yhig);
  cout << ylow << yhig << endl;

  delete file;

canvas->SaveAs( "savedgraph.pdf", "RECREATE")

Now, the problem is that in the saved pdf, all lower y-error bars are missing. They are simply not printed. The upper ones are, and the cout prints me a non-zero ylow value comparable in size to yhig.
I have no idea why this happens, mostly, because everything worked fine until a few days ago (Version5.30 I think but am not sure) and now it suddenly doesn’t. I suspect changes made in the version by my institute’s IT team, but should this be the problem what would I need to change on my side?

  • Does anyone have an idea what could cause lower error bars to disappear?
  • Is it a version problem and my code is obsolete now?

If it can help, I will expand the code above to include further details. I have attached the before-behaviour (I still have an old .png-version of the resulting graph), and the new one as images, on which I masked title and legends with black bars. You’ll notice that there are two graphs on the plot (red and green), both are made using the above method.

current Root version: ROOT 5.34/09 (v5-34-09@v5-34-09, Jun 26 2013, 17:10:36 on linuxx8664gcc)

Thanks in advance,


The code you posted cannot be run. It would be nice to have some code reproducing your problem in order to investigate it. And, yes, the ROOT version you are using is very old.


Hello Olivier,

Thank you for you reply, I am currently stripping it down to make it executable everywhere, shall I rather upload a version which leaves the whole code as less modified as possible, or limit it to an absolute MWE?

Meanwhile, I am wondering if it’s related to a gStyle command I may have missed, is that a possibility?

I have finished my simplified code, reduced from 300 to 50 lines. The resulting behaviour is still the same for the plot: lower error bars are missing.
It reproduces my macro’s behaviour, excepted the part about loading the files. Instead, I directly write the point and error values in the graph. Basically, I have just minimized everything that had to do with the loops. Hence, the names have changed compared to my initial post.

void PlotMWE(TString part="Test", TString corr="test"){
	//In my macro, this function gets called multiple times for different part and corr arguments.

	TString PARTICLE="Test";
	TString VARIABLES[1]={"gDelta"}; const Int_t nVARIABLES=1; //Those are normally 5

	UInt_t seasons_Begin[] = { 1, 2, 3}; //
	const Int_t nSeasons = sizeof(seasons_Begin)/sizeof(*seasons_Begin);

	for(int iVar=0; iVar<nVARIABLES; iVar++){
		TCanvas* canvas=new TCanvas( Form("%s", VARIABLES[iVar].Data() ), VARIABLES[iVar]);

		TMultiGraph* graph = new TMultiGraph();
		TGraphAsymmErrors* defivgraph=new TGraphAsymmErrors();
		TGraphAsymmErrors* desixgraph=new TGraphAsymmErrors();

		for( int iSea=0; iSea<nSeasons; iSea++ ){

			double xf= seasons_Begin[iSea];
			defivgraph->SetPoint(     iSea, xf, 1.7);
			defivgraph->SetPointError(iSea, 0, 0, 1, 0.5);

			double xs= seasons_Begin[iSea];
			desixgraph->SetPoint(     iSea, xs, 2);
			desixgraph->SetPointError(iSea, 0, 0, 1, 0.5);


		canvas->SaveAs( "PlotErrors.pdf", "RECREATE");

I execute the macro with root PlotMWE.C -l in the command line over an ssh connection to my institute’s workplace.
I have attached the above code as text file, too.
PlotMWE.C (1.4 KB)

The resulting pdf looks like this (I converted it manually to an image):

Try some newer ROOT version.

Hello Wile,
thank you for your answer, is it working normally on a newer version/on your side?
I am bound to the working environment of my institute, which is why I posted here:

  • Should the admins have changed the version, could that cause such a sudden and specific malfunctioning? Or cause a library issue? (As I said, the code worked earlier this week).
  • Or is the code missing something? (Or something I’d need to update in the first case)

I am running Windows 10 at home and don’t have installation rights at work (I’m a bachelor student), so testing the latest release would be very difficult.

It seems that you face some ROOT bug which was fixed in newer releases.

What you could try would be to use: canvas->Modified(); canvas->Update();

You do not need to rely on your “admins” for newer ROOT versions.

The ROOT team provides ready-to-use binary distributions, suitable for different operating system + compiler pairs, which you just need to download and unpack.

So, I could execute the MWE in Release 6.14/06 - 2018-11-05 and the resulting PDF looks as it should. I am baffled how the code could work one day and suddenly be victim of a bug out of nowhere.

My complete macro however, now returns me a lot of undeclared identifier errors I do not understand, since I was not confronted to them before.
But, well, at least the cause could be identified. I thank you all for your time and please pardon the troubles. I will delete the post this weekend as it is not relevant with the original question about TGraphAsymmErrors anymore.

I guess you need to spend some time porting your source code from ROOT 5 (which is more “permissive”) to ROOT 6 (which is more “strict” but better).

In the meantime, you could try one of the recent ROOT 5 releases: ROOT 5.34/38 or ROOT 5.34/36