Writing a title on a Canvas that has histograms

Hello rooters,

I have a canvas that is divided to 6 pads. Each pad has a histogram. I want to write a text “title” for the canvas. I tried using TPaveText, however, the histograms are being drown on top of it. I tried drawing the TPaveText after drawing the histograms, still it is in the back.
Is there a way to write a text on the canvas that will be on the top .

Best,

{
   TCanvas *C = new TCanvas("C","C",800,800);
   C->SetTopMargin( 0.5 );
   C->Divide(2,3);
   C->cd(1) ; gPad->DrawFrame(0.,0.,1.,1.);
   C->cd(2) ; gPad->DrawFrame(0.,0.,1.,1.);
   C->cd(3) ; gPad->DrawFrame(0.,0.,1.,1.);
   C->cd(4) ; gPad->DrawFrame(0.,0.,1.,1.);
   C->cd(5) ; gPad->DrawFrame(0.,0.,1.,1.);
   C->cd(6) ; gPad->DrawFrame(0.,0.,1.,1.);
   C->cd(0);
   TPad *PadTitle = new TPad("P","P",.5,.8,.8,.9); PadTitle->Draw();
   PadTitle->cd();
   TPaveText *pt = new TPaveText(0.,0.,1.,1.);
   pt->AddText("Title");
   pt->Draw();

}

Thanks! that worked!

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