TGraph* graph = new TGraph(n, x, y); graph->GetYaxis()->SetRangeUser(0, 5);
TGraph* graph = new TGraph(n, x, y); graph->GetYaxis()->SetTitle("Y-Axis Title");Here, a TGraph object is again created with n data points for the x and y arrays. The GetYaxis method is used to obtain a pointer to the Y-axis of the graph and the SetTitle method is called to set the label of the Y-axis to "Y-Axis Title". Package Library: ROOT.