Superimpose TH2 with "colz" option with different TH2 with "cont3" option

Hi! I need to superimpose two skymaps, i.e. thwo 2D histograms. The TH2 drawn with colz option has a certain binning and covers a certain range while the other TH2 has a finer binning and covers a smaller region falling into the rrange covered by the other TH2. I would like to draw only the contours of the second TH2,i.e. only lines such that the TH2 drawn below is visible. Any solution how to draw one TH2 ontop of the other despite the different binning and range and how not to cover parts of the bottom TH2?

It tried to produce an example according to your description:

void colcontsame() {
   TH2F *h1 = new TH2F("h1","h1",100,-10,10,100,-10,10);
   TH2F *h2 = new TH2F("h2","h2",40,-3,3,40,-3,3);
   for (Int_t i=0;i<1000;i++) {
      double x,y;
      gRandom->Rannor(x,y);
      h1->Fill(5*x,5*y,4);
      if(x<0 && y<0) h2->Fill(x,y,3);
   }
   h1->SetFillColor(1);
   h2->SetLineColor(kRed);
   h2->SetContour(5);
   h1->Draw("col");
   h2->Draw("cont3 same");
}

Hi! I managed to plot the contours ontop of the TH2 using the ContourList.C macro from the tutorial as guidline. However. I would need to use Cont4 option and if doing so, then the other contours are not visible anymore. When using Cont only then I see the other contoures but this is not the drawing option I would like to use. Any suggestion?

Two magic words: “transparent pad”:

hi! I was already thinking of doing this but I had no time yet to try.

Ok, let us know when you’ll have tried.

Hi! YEs I managed doing the trick with a transparent TPad. The important thing though was also to set the TFrame of the TPad transparent.

Many thanks