# graph2D SetPoint & TMultiGraph

ROOTers
For a 2D graph, what is the function of having the first parameter in the SetPoint() function:

void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)

As far as I have seen in the samples, it looks to me more like a counter, isn’t it? Is there any other use of this parameters?

Another question, is there a way to store Graph and Graph2D objects in a same container, something similar to TMultiGraph container in root? What I like about the TMultiGraph is that when I call the TMultiGraph:: Draw() member function, it will draw all the graphs stored in the container in the current canvas. However, it looks like Graph2D objects cannot be stored in TMultiGraph containers because they (Graph2D) are not derive from the Graph class.

Cheers,
Cristian

You will find the explanation in the doc here:
root.cern.ch/root/html/TGraph2D.html

It would be difficult to handles TGraph2D and TGraph in the same TMultiGraph as they do not have the same dimension. For instance how would you plot them ?

[quote=“couet”][quote]
For a 2D graph, what is the function of having the first parameter in the SetPoint() function:

void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)

As far as I have seen in the samples, it looks to me more like a counter, isn’t it? Is there any other use of this parameters?
[/quote]

You will find the explanation in the doc here:
root.cern.ch/root/html/TGraph2D.html[/quote]

How could I map the “point” parameter into a 3D field (x,y,z). Sorry, it is still not clear how I could use that parameter. Would that mean that every coordinate x,y,z is associated to a “point” number?
Cristian

[quote=“couet”][quote]
Another question, is there a way to store Graph and Graph2D objects in a same container, something similar to TMultiGraph container in root? What I like about the TMultiGraph is that when I call the TMultiGraph:: Draw() member function, it will draw all the graphs stored in the container in the current canvas. However, it looks like Graph2D objects cannot be stored in TMultiGraph containers because they (Graph2D) are not derive from the Graph class.
[/quote]

It would be difficult to handles TGraph2D and TGraph in the same TMultiGraph as they do not have the same dimension. For instance how would you plot them ?[/quote]

I think I find what I need it. TObjArray should do the trick for me. As you said, what I have to do is associated a TObjArray to each subpad in my canvas. The only thing I need to be careful is to make sure that each subpad in my canvas handle only either graphs objects or grapgh2d objects. To have a mix of those two types in a single subpad could be lethal…

Thxs for the replies…
Cristian

In SetPoint, the first parameter is simply an index in the X Y Z arrays… I do not understand why it is so mysterious for you… I do not know what to say more…