TPaveLabels

Hello,

I am encountering problems displaying TPaveLabels on histograms.
The following chunk of code works on command line only (providing the file and histogram are available). Notice that the TPaveLabel must be drawn twice.
However in a macro, the same code produces only the histogram (I think the label is drawn very small to the bottom left of the histogram) and furthermore I cannot see both the label and the histogram together. Is this a bug or am I doing something wrong? I am using v5.13/05.

{
TFile *f = new TFile(“File.root”);
TCanvas *can= new TCanvas(“can”);
TH1D rs=(TH1D)f->Get(“histname”);
TPaveLabel *p1= new TPaveLabel(0.7,0.40,0.9,0.65,“HELLO”);
p1->Draw();
rs->Draw();
p1->Draw();
}

Many thanks.

Laura

Laura,

You must create your TPaveLabel in NDC coordinates and draw it only once.
see code below

{ TFile *f = new TFile("File.root"); TCanvas *can= new TCanvas("can"); TH1D *rs=(TH1D*)f->Get("histname"); TPaveLabel *p1= new TPaveLabel(0.7,0.40,0.9,0.65,"HELLO","brNDC"); rs->Draw(); p1->Draw(); }

Rene