Superimposing two TGraphs with different ranges

I’m new in the ROOT community!
…looking to the example of macro illustrating how to superimpose two histograms I was able to superimpose two TGraphs with different ranges and to draw a new Yaxis for the second one (see the png file attached).
Now I would like to change:

  • the plotTitle
  • the color of the left axis title
    and add the axis title on the right (I was trying to do with SetTitle(“Rates [Hz]”) but it doesn’t work)

how can I do it?

I attach the code I used for it
Superimpose_rates.C (2.28 KB)

1 Like

Thank you very much Pepe for the advice
It works! :smiley:
The only thing I would like to change now is the Title on the top.
as now I’m using the command

g1->SetTitle("#splitline{Variation of Collection Efficiency and Rates}{ #DeltaV_{THGEM1} = 1100V  #DeltaV_{THGEM2} = 1100V #DeltaV_{Mesh} = 500V};  Drift Voltage [V];Collection Efficiency");

which is setting the top title, the Xaxis title and the Yaxis title for the first TGraph, how can I select in this case only the top title? Is it possible somehow to set an offset on it with a command like


or to decrease the size of it?

  // ...
  TPad *p1 = new TPad("p1", "", 0, 0, 1, 1);
  p1->SetTopMargin(0.15); // 15% top margin
  // ...
  TPad *p2 = new TPad("p2", "", 0, 0, 1, 1);
  p2->SetTopMargin(0.15); // 15% top margin
  // ...
  Double_t dy = (ymax - ymin) / 0.75; // 15% top margin and 10% bottom margin
  p2->Range(xmin-0.1*dx, ymin-0.1*dy, xmax+0.1*dx, ymax+0.15*dy);
  // ...

Sorry for late reply…It works perfectly! :smiley:
Thank you so much for the help! :slight_smile: