Re: [ROOT] 2d histogram titles

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri May 02 2003 - 09:22:55 MEST


Hi Chris,

In case of a 2-d histogram (generated by TTree::Draw) a copy of the
histogram is created in the current pad to draw the pad frame. The title
displayed in the pad is the title of the histogram copy, not of the
original histogram. On top of this empty histogram, a 2-d polymarker
with the exact values Xi,Yi is drawn. The other 2-d histogram (h2)
has its bin contents filled with Xi,Yi, but it is not drawn because
it is better to draw the points with their exact position instead
of the markers generrated randomly within a cell.

In your example, you can change the title appearing in the pad.
See the mods in your example below.

An alternative is to create the 2-d histogram before calling TTree::Draw

Rene Brun

Chris Crawford wrote:
> 
> hi,
>   there is a problem with changing the title of temp 2d histograms.  i
> like to use htemp because it draws as a pure scatter-plot, instead of
> showing blocks for each bin (plus it is easier!)
> --chris
> 
>       root v3.05.03
> 
>       TNtuple n("n","n","a:b");
>       n->Fill(1,2);
>       n->Fill(2,2);
>       n->Draw("a>>h1");
>       h1->SetTitle("h1");     // works fine
>       n->Draw("a:b>>h2");
        TH2F *frame = (TH2F*)gPad->GetPrimitive("h2");
        frame->SetTitle("h2")
>       //h2->SetTitle("h2");    // ???



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET