Draw two TH2 on the same canvas with different Yaxis

Hi, I am trying to draw on the same canvas two TH2 where the X-axis is in common while the Y-axis is different for the two (and I have no interest on the Z-axis).

I do know how to draw a new TGaxis on the top/right side, but I do not know how to scale accordingly the second plot I draw, it gets plotted on the “first axis”.

The code I am using now is:

TCanvas *c1 = new TCanvas("c1");

  line->Draw("dx:pos","","line");  //draw just to get dxmax and dxmin, it gets overwritten
  double dxmax = gPad->GetUymax(); //
  double dxmin = gPad->GetUymin(); // 

  line->SetLineColor(kRed);
  line->Draw("betx:pos","","line");
  line->SetLineColor(kGreen);
  line->SetLineStyle(1);
  line->Draw("dx:pos","","linesame");
  TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),gPad->GetUxmax(), gPad->GetUymax(),dxmin,dxmax,510,"+L");
  axis->Draw();
  c1->SaveAs("c1.eps");

Thank you for your help

Andrea

You will need to make an overlay pad like in this example:
https://root.cern/doc/master/transpad_8C.html