Writing text on FOREGROUND on a Canvas

Bonjour,
I’m getting nuts for the following reason : the very simple example below does NOT draw the title from the TPaveLabel object. More precisely, most of the text is hidden behind some layers which probably correspond to various graphic objects (pads). I cannot find how the full text can appear on the FOREGROUND and not be partially hidden (“Bring to front” button on many laptop graphic applications, for example).

Here is the piece of code :

TCanvas *c1 = new TCanvas(“c1”,“Histogram Drawing Options”,200,10,700,900);
sqroot = new TF1(“sqroot”,“gaus”,0,10);
sqroot->SetParameters(10,4,1);
c1.Divide(2,2);
c1.cd(1);
sqroot->Draw();
c1.cd(2);
sqroot->Draw();
c1.cd(3);
sqroot->Draw();
c1.cd(4);
sqroot->Draw();
c1.cd();
TPaveLabel *title = new TPaveLabel(0.1,0.94,0.9,0.98,“Drawing options for one dimensional histograms”);
title->SetFillColor(16);
title->SetTextFont(52);
title->Draw();

Thanks in advance for you help,
– Philippe Ghez

make a new pad on top of your existing pads…

{
TCanvas *c1 = new TCanvas("c1","Histogram Drawing Options",200,10,700,900);
sqroot = new TF1("sqroot","gaus",0,10);
sqroot->SetParameters(10,4,1);
c1.Divide(2,2);
c1.cd(1);
sqroot->Draw();
c1.cd(2);
sqroot->Draw();
c1.cd(3);
sqroot->Draw();
c1.cd(4);
sqroot->Draw();
c1.cd();
TPad *newpad=new TPad("newpad","a transparent pad",0,0,1,1);
newpad.SetFillStyle(4000);
newpad.Draw();
newpad.cd();
TPaveLabel *title = new TPaveLabel(0.1,0.94,0.9,0.98,"Drawing options for one dimensional histograms");
title->SetFillColor(16);
title->SetTextFont(52);
title->Draw();
}

Works as expected :slight_smile:
Thanks a lot !!!
– filip