Re: [ROOT] Variable binwidth in histograms

From: Matevz Tadel (Matevz.Tadel@ijs.si)
Date: Sun Aug 13 2000 - 14:39:03 MEST


Hi Claire ...

Float_t bins[] = { 50, 55, 60, 65, 72, 80, 90, 100, 120, 160 };
Int_t  binnum = sizeof(bins)/sizeof(Float_t) - 1; // or just = 9
TH1F* h = new TH1F("n","t", binnum, bins);

See the 3rd(or 4th) constructor for TH1 in the docs ...

Cheers,
matevz

On Sun, 13 Aug 2000, Claire Gwenlan wrote:

> Hi,
> 
> Can you make a TH1 with variable bin widths. I have a plot where I want to
> set the edges of the bins out as:
> 
> 50, 55, 60, 65, 72, 80, 90, 100, 120, 160
> 
> i.e. 50 and 160 are my extreme values and I have 9 bins of variable width.
> I couldn't find out how to do this.
> 
> Cheers,
> 
> Claire
> 
> 
> __________________________________
>  Claire Gwenlan
>  Department of Physics & Astronomy
>  University College London
>  Gower Street
>  LONDON
>  WC1E 6BT
> 
>  Tel: (0171) 419 3454
> _________________________________
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET