Issue when drawing TGraph2D (interpolation ?)

Dear ROOT experts,

I recently updated my old root (v5.26.00e) to the last one (v5.34.14). Since it, I have some troubles to draw TGraph2D. Here you can see what my TGraph2D looks like when draw with v5.26.00e :

And now, the same, but draw with v5.34.14 :

As you can see the result isn’t exactly what I was expected. I can do some zoom (on color scale) and then have color scale similar to the one with v5.26.00e. Yet the blank area is still blank.

I looked a bit in the root sources, and find that issue seems to be related to interpolation for TGraph2D (in TGraphDelaunay) : with the use of two scaling factor (one for X and another for Y) in v5.34.14 (since a while) whereas there was only one scaling factor in v5.26.00e.

I did some “naive” tests :

  • modification of TGraphDelaunay.cxx to use only one scaling factor :
  • if I use the same than in v5.26.00e : 2./((xmax-xmin)+(ymax-ymin)). I avoid the issue.
  • if I use the Y scaling factor of v5.34.14 : 1./(ymax-ymin). I avoid the issue too.
  • if I use the X scaling factor of v5.34.14 : 1./(xmax-xmin). I don’t avoid the issue.
  • if I modify the limits of my TGraph2D to a lesser value. I avoid also the issue with it. Yet, I have some reasons to want to keep the limits of the TGraph2D at 3000 and so I would like to not use this solution.

Is this issue expected ? Is there any (other) solution to fix it ?


Can you post a small example reproducing this problem ?

You can find here a quick code that I did to fill the TGraph2D with random values (it’s maybe not as small as you were asking however, sorry). There is the same issue.
RandomTGraph2D.C (3 KB)

With root v5.34.14 :

With root v5.26.00e :

I cannot run your macro. I get:

root [0] .x RandomTGraph2D.C
Error: Can't call vector<double,allocator<double> >::assign(0x1000,0) in current scope RandomTGraph2D.C:49:
Possible candidates are...
(in vector<double,allocator<double> >)
*** Interpreter error recovered ***
root [1] 

I think you need to compile it (.x RandomTGraph2D.C++).

root [0] .x RandomTGraph2D.C++
Info in <TUnixSystem::ACLiC>: creating shared library /WORK/test-root-version-issue/./
root [1] TFile *_file0 = TFile::Open("RanTGraph2D.root")
root [2] tgraph2d->Draw("colz")
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1

Thanks for caring !

I see now. There is a hole in the middle which makes the Z dynamic larger force all the intersection Z variations in the red range. I will check.

I think it is enough to do:


        TGraph2D *gr=new TGraph2D();


It’s worked perfectly with it. Thank you very much !

Good :slight_smile:

I was wondering if printing a warning suggesting to increase MaxIter, would be a good idea in case you have this kind of hole…