Left axis when graphs with two scales

Hi, I am having an issue when plotting together two graphs with different scales.

I followed the tutorial transpad.C and it works fine apart from a detail: in the end I get the ticks and labels of the right Y axis (with a different scale) also on the left side of the pad. This superimposes with the ticks of the first graph Y axis and overall is not readable.

Could please give some advice?

Thank you!

I guess you modified the original macro. Can you post you version ?

Also note that the options X+ and Y+ may be used too:

{
   TCanvas *c1 = new TCanvas("c1","c1",600,600);
   TPad *pad1 = new TPad("pad1","",0,0,1,1);
   TPad *pad2 = new TPad("pad2","",0,0,1,1);
   pad2->SetFillStyle(4000); //will be transparent
   pad2->SetFrameFillStyle(0);


   TH2F *h1 = new TH2F("h1","h1",40,-4,4,40,-4,4);
   TH2F *h2 = new TH2F("h2","  ",40,-40,40,40,-40,40);
   Double_t a,b;
   for (Int_t i=0;i<5000;i++) {
      gRandom->Rannor(a,b);
      h1->Fill(a-1.5,b-1.5);
      h2->Fill(10*a+1.5,10*b+1.5);
   }

   pad1->Draw();
   pad1->cd();
   h1->Draw("");

   pad2->Draw();
   pad2->cd();
   h2->SetMarkerColor(kRed);
   h2->Draw("X+Y+");
}

Thank you, for some reason I was using some code where I also included the use of additional TFrames.

Now it’s working fine, thank you again.

Regards

Another example of using the Y+ from last month (in python):

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.