THStack *histStack = new THStack("histStack", "Histogram Stack"); histStack->Add(hist1); histStack->Add(hist2); histStack->Draw(); histStack->GetYaxis()->SetTitle("Counts");
THStack *histStack = new THStack("histStack", "Histogram Stack"); histStack->Add(hist1); histStack->Add(hist2); histStack->SetTitle("Histogram Stack Title"); histStack->GetYaxis()->SetTitleFont(42);In this example, a THStack object named histStack is created and two histograms (hist1 and hist2) are added to it. Then, the SetTitle method is called to set the title of the histogram stack to "Histogram Stack Title". Finally, the GetYaxis method is used to retrieve a pointer to the Y-axis of the histogram stack and set its title font to 42. These examples show that the GetYaxis method can be used to access and modify properties of the Y-axis of a THStack object. The ROOT data analysis framework is the package library used for these examples.