TGraph2D SetPoint problems inside a non-for loop

Just to summarize the problem:

  1. “older” ROOT versions are not able to draw 2D graphs if any “[XY]min = [XY]max” (one gets “Error in TView3D::ResetView: Error in min-max scope” and so on)
  2. “new” ROOT version (5.34) will draw them but the 3D view will still be wrong

You can take any trial “CODE:”
[url]TGraph2D SetPoint problems inside a non-for loop
[url]TGraph2D SetPoint problems inside a non-for loop
modify the line:
g2->SetPoint(i, x, y, z);
into:
g2->SetPoint(i, 1., y, z); // enforce the same “x” for all points
or into:
g2->SetPoint(i, x, 1., z); // enforce the same “y” for all points
and then try to run it.

Well, you can try to compile the attached modified “myFilename.C” (your compiler should be happy now) but it is NOT a “running example”.
myFilename.C (5.87 KB)

I see, the trial function is running. What you do cannot work. The SURF options define their own 3D normalised space which does not correspond to the value you see on the axis. You cannot draw a 3D polyline that way on a surface.

Forget the 3D polyline for the moment (just comment out the line “l->Draw();”).
The problem is that, as soon as you enforce the same “x” or “y” for all points of the “g2” 2D graph, the “z” axis range of the 3D view will unconditionally be set to -1 … +1.

If you align all the points like that then the interpolation to fill the 2D underlaying histogram will not work. Therefore all the plotting options like TRI LEGO SURF etc cannot work. The only valid options will be P or P0

Well, with “P0” and “P” I get many times an “Error in TView3D::ResetView: Error in min-max scope” plus a “segmentation violation” (if all points have the same “x” or “y”) for my first trial, and nothing at all is drawn for my second trial (and no errors appear).

Now fixed in the trunk and in 5.34.