How to set Size of Title?

    g->GetYaxis()->SetRangeUser(-0.01, 0.1);  // set range 

    g->SetTitle("Comparison of efficiency at different distances");

    g->GetXaxis()->SetTitle("distance d [cm]");

    g->GetYaxis()->SetTitle("efficiency #varepsilon");


I can set size of title X axis and Y axis, but I can not set size of title for the graph.
I mean that there isn’t command g->GetTitle()->SetTitleSize() Could you help me, please?


I think it is used for Histogram. I tried to run code with that command, the header of graph moved, not changed size.

   TCanvas *c = new TCanvas("c","A Simple Graph without axis",700,500);
   const Int_t n = 10;
   TGraph *gr = new TGraph(n);
   gr->SetTitle("A Simple Graph Example");
   gr->GetXaxis()->SetTitle("X axis");

   Double_t x, y;
   for (Int_t i=0;i<n;i++) {
      x = i*0.123;
      y = 10*sin(x+0.2);

1 Like

Thank you for your helping.