Hello Rene,
If I do
hnew->Draw()
My title gets displayed, but the scatter plot gets discretized - in
other words, it looks like a 2D histogram (with points randomized within
each bin)
The second method works (create the histogram with a title before using
it.) However, it does not work if I want to used root's default binning:
e.g.
TH2F *hnew = new TH2F();
hnew->SetNameTitle("hnew","My Title");
pT->Draw("a:b>>hnew")
This does not display "My Title" as the title.
Anyhow, this is not a serious problem, and I do have a work-around.
Thanks!
Ed Oltman
> -----Original Message-----
> From: Rene Brun [mailto:brun@pcbrun.cern.ch]
> Sent: Monday, June 30, 2003 2:14 PM
> To: Ed Oltman
> Cc: Roottalk@Pcroot. Cern. Ch
> Subject: Re: [ROOT] setting the displayed title of a histogram
>
>
> Hi Ed,
>
> After hnew->SetTitle("My Title");
> add
> hnew->Draw();
>
> or, do
> TH2F *hnew = new TH2F("hnew","My Title",100,0,10,100,0,20);
> pT->Draw("a:b>>hnew");
>
>
> Rene Brun
>
> On Mon, 30 Jun
> 2003, Ed Oltman wrote:
>
> > Hello,
> >
> > I would like to create a histogram using TTree::Draw() and then
> > change the title:
> >
> > The following code snipped does not display "My title"
> >
> > TTree *pT = pointer to a tree
> >
> > pT->Draw("a:b>>hnew(100,0.,10.,100,0.,20.)");
> > TH2F *hnew = (TH2F *)gDirctory->Get("hnew");
> > hnew->SetTitle("My title");
> >
> > It does not change the title. hnew->GetTitle() returns "My title", but
> > I can't seem to get it to display.
> >
> > I'm guided here by the following does which does display "My title":
> >
> > pT->Draw("a:b")
> > TH1F *htemp = gPad->Get("htemp")
> > htem->SetTitle("My title")
> >
> > I am using win32 version of root 3.05/3 on Win2k. Thanks
> >
> > Ed Oltman
> >
> >
>
>
>
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET