TGraph* graph = new TGraph(); graph->SetPoint(0, 1, 2); graph->SetPoint(1, 3, 4); graph->SetPoint(2, 5, 6); double y0 = graph->GetY(0); // y0 == 2 double y1 = graph->GetY(1); // y1 == 4 double y2 = graph->GetY(2); // y2 == 6
void doSomething(TGraph* graphPtr) { double y = graphPtr->GetY(0); // ... }This example demonstrates the use of GetY in a function that takes a TGraph pointer as an argument. It retrieves the y-coordinate of the first data point in the graph and performs some operation on it. Overall, GetY is a useful function in the TGraph class that allows you to retrieve the y-coordinate of a data point in a graph quickly and easily.