Drawing over a sub-pad

Hi,

Is it possible to draw objects OVER a sub-pad (from the base pad)? In the following example, the sub-pad hides the line. Can the line be on top of the sub-pad?

Reason: I’d like to use a sub-pad as a container for a TH2F color map which would be overlapped by a drawing made in the base pad.

{
TCanvas *c1 = new TCanvas(“c1”, “c1”);
c1->Draw();
TPad *pad = new TPad(“pad”, “pad”, 0.3, 0.3, 0.7, 0.7);
pad->Draw();
TLine *line = new TLine(0.1,0.5,0.9,0.5);
line->Draw();
}

you can create a tranparent pad covering the other pads and draw in there. To make a pad transparent use a fillstyle between 4000 - 4100 where 4000 is 100% transparent and 4100 100% opaque.

Cheers, Fons.

If you want to draw also histograms in subpads you can use the following method:

{
   // to make histogram TFrame transparent
   gStyle->SetFrameFillStyle(0);

// create canvas and subpads
   TCanvas * cc = new TCanvas("cc","Canvas",600,600);
    cc->Divide(2,1);
    TH2F *hist = new TH2F("hist","hist",50,-2,2,50,-2,2);
     hist->FillRandom("gaus");
     cc->cd(1);
     gPad->SetFillStyle(0); // or you can use FillStyle(4000 -- 4100) 
     hist->Draw("box");
     cc->cd(2);
     gPad->SetFillStyle(0); // !!! don't forget for each subpad!!!!
     hist->Draw();

     // Draw in main Canvas;
     TLine *lin = new TLine(0.1,0.1,0.9,0.9);
     lin->SetLineWidth(5);
     cc->cd(0);
      lin->Draw();
     cc->Update(); // VERY IMPORTANT, or else you'll see nothing.
}