[Fwd: Re: Text in Pads]

Rene Brun (Rene.Brun@cern.ch)
Tue, 10 Feb 1998 10:39:24 +0100


Message-ID: <34DB2A9B.14EBE086@mail.cern.ch>
Date: Fri, 06 Feb 1998 16:22:05 +0100
From: Rene Brun <brun@mail.cern.ch>
Organization: CERN. European Lab. for Particle Physics
X-Mailer: Mozilla 4.04 [en] (X11; I; HP-UX B.10.20 9000/755)
MIME-Version: 1.0
To: Stephen_Eichblatt <eichblat@fibb01.fnal.gov>
CC: roottalk@hpsalo.cern.ch
Subject: Re: Text in Pads
References: <9802030549.AA32826@fibb01.fnal.gov>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Stephen_Eichblatt wrote:

> Hi,
>
> I am trying to draw a histogram in a pad and then place some text at a given
> location in the pad. (eg. the center of the pad).
> But it seems that the co-ordinate frame in the pad goes to the histogram co-ordinates
> once the histogram is drawn, so finding the center of the pad depends on the histogram.
>
> I thought the Pad->DrawTextNDC(0.5,0.5,"hello") would work, but it doesn't
> do what i thought (it does nothing as far as i can see).
>
> Other than getting the histogram information, is there a way to position text
> in a pad?

In the current version 1.03, you cannot draw directly a TText in NDC,
other than getting the histogram information.
I have implemented this feature in our dev version.
You can use a TPaveLabel however. Example:
TPaveLabel *label = new TPaveLabel(0.4,0.45,0.5,0.55,"Hello","brNDC");
label->Draw();

You can get vthe text only via a trick
label->SetFillColor(gPad->GetFillColor());
label->SetBorderSize(0);

Rene Brun