#include "TH2F.h" // Create a 2D histogram TH2F* myHist = new TH2F("myHist", "My 2D Histogram", 10, 0, 10, 10, 0, 10); // Get the X axis of the histogram TAxis* myXaxis = myHist->GetXaxis();
#include "TH2F.h" // Create a 2D histogram TH2F* myHist = new TH2F("myHist", "My 2D Histogram", 10, 0, 10, 10, 0, 10); // Get the X axis of the histogram TAxis* myXaxis = myHist->GetXaxis(); // Set the X axis label myXaxis->SetTitle("X axis label");In this example, we create a 2D histogram and retrieve its X axis. We then set the title of the X axis using the SetTitle() function. The TH2F class is a part of the ROOT package library.