TGraph2D interpolation


I’ve been using TGraph2D and noticed that when I try to run over a large array of numbers, it gives some unexpected results (there are large islands in the graph which are not filled etc). However, when I dice the dataset into smaller slices then it works fine. I tried setting gr->SetMaxIter(500000) but even with this I get the same result. I’ve attached a simplified version of my macro, together with the data file and the resulting Tgraph2D.

Thanks for the help!

c2.pdf (16.9 KB)
TestTGraph2D.C (619 Bytes)
data.dat (329 KB)


We know of the current limitations of the interpolation algorithm present in TGraph2D, in particular in case of a large number of data points.
We are working on a new versions, which hopefully will be available soon.
As an alternative, you could use the linear 2D interpolation available in case of the TH2 histogram class. You would need however to bin your data, i.e. put them in a regular grid.

Thanks for your post and the example code

Best Regards