Re: [ROOT] How to make bin area equal bin content?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Sep 16 2004 - 09:04:06 MEST


Hi Simon,

Good point. I will add this functionality by default to TH1::DrawNormalized
in case of histograms with variable bin size.

Rene Brun

sdean wrote:
> 
> Hi ROOTers,
> 
> If I have a histogram with variable bin widths, how can I draw it so that
> the area of each bin is equal to the bin content? In other words, if my
> bin width is 5 and there is 1 entry, I want the bin height to be 0.2, not
> 1. I can obviously do this with:
> 
> for (int i=1;i<nbins;++i){
>   histo->SetBinContent(histo->GetBinContent(i)/histo->GetBinWidth(i));
> }
> 
> but I was hoping there would be a draw option to make it easier.
> 
> Thanks for any help,
> 
> Simon



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET