TGraph2D maximum size

Dear all,

I am using a TGraph2D class to plot some 3D data.

If I directly set the points or read a file I saw some zeros that are not in the data.

After investigation, I realized that if I am using a data set smaller (fNpoints <= 483) than the real one (several hundreds) the result is the one expected (with the limited number of points of course).

My question is: is there any limitation on the number of points and if yes how can I extend it ?
I am using ROOT 5.34/18

Regards
Julien

“several hundreds” should not be a problem at all


Thank you for your quick reply but speed is not exactly the problem.

Furthermore, it does not depend on the type of draw option I am using (even w/ “TEXT” I can see the zeros)

However the post you pointed me at does indirectly suggest that there is a internal limitation, since my colleague is using there thousands of points.

Regards
Julien

Ps: I saw later your edit and the 2nd post your suggested. SetMaxIter() does not seem to change things, which is logical since my problem does not seem to depend the draw method…

Why don’t you post the file with your data and a small macro which creates the graph, so that one can reproduce your problem.

Attached is a data file for example (tmp.dat)

The code I used to draw the attached picture is:

TGraph2D *g = new TGraph2D("tmp.dat")
g->Draw("text")

where you can see the zeros.

Regards
J.



tmp.dat (11.2 KB)

Where your picture (“c1.png”) shows " 0 ", I simply see a “white space” (I tried it with ROOT v5-34-22 and v6-02-01) but the rest of the picture looks the same, except that the title of your canvas looks different from mine and I have no “date” in the bottom-right.

Well, I think you must have something in your “~/.rootrc” and/or “./.rootrc” and/or “./rootlogon.C” files that changes the default behavior.

Well, I think I have found a potential cause … see if you use anywhere:
gStyle->SetHistMinimumZero(kTRUE);
and if yes, just before drawing the graph, change it into:
gStyle->SetHistMinimumZero(kFALSE);

no it does not solve the problem (now I have white space like you do but there must be something there > 0 !)

I guess “TEXT” also do some interpolation (that fails here ?).

I look at the TGraph2D documentation and did not found a way to obtained the values (like a GetPoint() method).

This could be a solution to decide if the problems comes from the interpolation (as the posts you point me
at suggest) or from a bad “reading” of the points (from the file)

J.

Add two new “artificial” points to your “tmp.dat” file:
-0.1 -0.1 1.0
0.7 0.4 13.0
then try:
TGraph2D *g = new TGraph2D(“tmp.dat”)
g->Draw(“P0”)
or try:
TTree *t = new TTree(“t”, “t”)
t->ReadFile(“tmp.dat”, “x/D:y:z”)
t->Draw(“z:y:x”)
t->Scan()

There’s some kind of a bug in the g->Draw(“P0”) graphics output -> an additional circle is drawn right in the middle of the canvas at around “0.3 0.15 7.0” (this additional circle stays in the middle when one rotates the picture using the mouse).
I think this bug is related to the fact that one point is NOT drawn at all -> “0.7 0.4 13.0” is missing.
I can reproduce this bug using a modified “tmp.dat” file (attached). Note that in this case a whole bunch of points are missing (all points with y = 0.3) and this additional circle right in the middle is present at around “0.3 0.2 6.9”.
This bug exists in ROOT v5-34-22 and v6-02-01.
tmp.dat (8.37 KB)

Hello,

Yes. This is exactly why I started looking at this problem.

Note that I tried to read the Graph values (to test if the problem come from the display or the data “storage” in TGraph2D) but the Print() method as implemented in TGraph (1D) is not present in TGraph2D. And no GetPoint() method as well.

Do you have a way to read fX,fY,fZ directly ?

J.

using SavePrimitive() I could inspect the data save in the TGraph2D.
They look ok (i.e. more than 500 pts w/ no unexpected zeros)

Conclusion : this is indeed a problem of display.

J.

I just played a it with you data set.

I did:

TGraph2D *g = new TGraph2D("tmp.dat");
g->Draw("p0");

Then I saved the canvas in a c1.C file… with some editing I made a c1.dat file to ease the comparison with tmp.dat. Both data set are the same. I noticed that straight line you have at Y=0 …
it is indeed in your data set you have several point like xxx 0 2.7807 … they draw this line…
I could not identify any wrong plot in the plots I get (see the attached plot).


You will not see the bug with the original “tmp.dat” file.
Try what I wrote in my previous post here.

Looking at the TGraph2DPAinter code I see that some points exactly on the limits might be excluded because of these tests:

      if(fX[it] < fXmin || fX[it] > fXmax) continue;
      if(fY[it] < fYmin || fY[it] > fYmax) continue;
      if(fZ[it] < hzmin || fZ[it] > hzmax) continue;

Commenting them cure the problem but that’s not a solution because points really outside should be excluded (in case of option SAME).

I think the following small data set is enough to show the problem:

0.3900 0.1000 6.2470
0.3950 0.1000 6.3068
0.4000 0.1000 6.3640
0.4050 0.1000 6.5355
0.4200 0.1000 6.8323
0.4100 0.1000 6.6405
0.4150 0.1000 6.8628
0.3900 0.2000 5.6937
0.3950 0.2000 5.8906
0.4000 0.2000 6.0561
0.4050 0.2000 6.0945
0.4100 0.2000 6.3509
0.4150 0.2000 6.2760
0.4200 0.2000 6.5408
0.4150 0.3000 6.1869
0.3900 0.3000 5.7663
0.4100 0.3000 6.2638
0.4050 0.3000 6.0564
0.4000 0.3000 5.8970
0.3950 0.3000 5.8762

With the little data set posted in my previous post I recommend the following macro.

{
   TGraph2D *g = new TGraph2D("tmp2.dat");
   g->SetMarkerStyle(20);
   g->Draw("p");
   g->GetHistogram()->SetMinimum(5.);
   g->GetHistogram()->SetMaximum(7.);
   g->GetHistogram()->GetYaxis()->SetLimits(0.09,0.31);
   g->GetHistogram()->GetXaxis()->SetLimits(0.38,0.43);
}

I think the same recipe can be done on the original data set.

Your “small data set” shows one problem only -> some points are not drawn in the canvas.
With my data set you should also see another bug -> an additional artificial circle in the middle of the canvas (a “false” additional data point).

@Wile: in the following example tmp2.dat is your modified data set.

{
   TGraph2D *g = new TGraph2D("tmp2.dat");
   g->SetMarkerStyle(20);
   g->Draw("p");
   g->GetHistogram()->SetMinimum(2.);
   g->GetHistogram()->SetMaximum(12.);
   g->GetHistogram()->GetYaxis()->SetLimits(0.09,0.31);
   g->GetHistogram()->GetXaxis()->SetLimits(0.,0.7);
}


Sorry, I forgot to say that, in order to see this “artificial circle” bug, you must not “SetLimits” (but you can “SetMinimum” and “SetMaximum”).

Fixed. Thanks for reporting.

Both problems existed in ROOT v5-34-22 and v6-02-01 -> did you fix it in both branches?