Re: titling histograms

From: Otto Schaile (Otto.Schaile@Physik.uni-muenchen.de)
Date: Fri Oct 01 1999 - 18:56:12 MEST


On Fri, 1 Oct 1999, Stephen Markacs wrote:

  Hi Stephen,
> 
> This doesn't work for me.  When I click in the histogram with the right
> mouse button, I get a TFrame menu, which doesn't have a SetTitle.  If I
> click on the title of the histogram, I get a TPaveText::title menu, which
> has a very promising looking EditText item, except it just doesn't work. 
> Selecting it completely fails to do anything whatsoever. 

To get the popup for the histogram the pointer must be on horizontal
parts of the histogram contour line for a 1-dim hist. Just clicking
inside the box you get the TFrame.

> 
> What I'd really like is a way to do it from the root prompt.  I've
> generally had bad experience with doing things by mousing on the canvas
> (I've had it lock up too many times when doing so)  But if there is a
> working mouse-based solution, I'd use it.

>From the root prompt it works like this:

root [0] f=new TFile("hsimple.root")
(class TFile*)0x0
root [1] f->ls()
TFile**         hsimple.root
 TFile*         hsimple.root
  KEY: TH1F     hpx;1   This is the px distribution
  KEY: TH2F     hpxpy;1 py vs px
  KEY: TProfile hprof;1 Profile of pz versus px
  KEY: TNtuple  ntuple;1        Demo ntuple
root [2] hpx->Draw()
Warning in <MakeDefCanvas>: creating a default canvas with name c1
root [3] hpx->SetTitle("new title")
root [4] 

Note within the CINT interpreter the line:

hpx->SetTitle("new title")

is a shortcut for:

TH1F* h = gROOT->FindObject("hpx");
h->SetTitle("new title");

Good luck
Otto

----------------------------------------------------------------------------
Otto Schaile                    Sektion Physik der LMU Muenchen
Phone: (+49 89)289 14070        Am Coulombwall 1, D-85748 Garching, Germany
FAX:   (+49 89)289 14072        EMail: Otto.Schaile@Physik.Uni-Muenchen.DE



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:40 MET