Draw TTree and TGraph2D on same axes

Hi,

I have a TGraph2D which is used to draw a 3D surface.

TGraph2D* BSeaLevel = new TGraph2D(360*720);
//Fill TGraph
BSeaLevel->Draw();

I then try to draw points from a TTree onto the same set of axes by the following

TTree* tTree = new TTree(“tTree”, “tTree”);
tTree->Draw(“latitude:longitude:z”, “( C )*(C != 0)”, “textsame”);

I use "textsame" in the hope that I could easily see the data from the TTree whilst it is on the same set of axes as BSeaLevel. However, I cannot see the data from the tree. Now, I know that the ranges are the same, and therefore the data from both the tree and the graph should not be out of range.

Is there anything I am not doing correctly?

The text option in 3D does not exist

1 Like

Hi couet,

Sure, but once I change to just "same" I get the following error

Error in TSelectorDraw::Begin: You cannot use option same when no 3D view exists.

EDIT: Apologies, that error exists even when I used "textsame".

Can you provide a small script (we can run) reproducing the problem ?

Would it be a possibility to draw the tree first without same and then the TGraph2D over it ordoes this give you an error too?

1 Like

The code already provided is too limited to understand what’s really going on …
That’s why I asked for a reproducer.

Hi,
It turns out by switching the TGraph2D and TTree, it fixes the problem.
Appreciate the help, but it is weird that it didn’t work the other way round.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.