Drawing 1D histograms. y range determination

Dear all,

I’ve just noticed something peculiar when drawing 1D histograms.

doing :
TH1F h(“h”,"",3, 0,3)
h->Fill(0,110)
h->Fill(1,111)
h->Fill(2,115)
h->Draw()

I get the histogram drawn with a y range going from a bit less than 110 to a bit more than 115. It is a bit misleading for me, since you do not get an idea of the statistics involved without looking at the scale… What I would like is :

  • when the values in all bins are positive, the y range starts at 0.
  • when at leat one value is negative, the min y is determined automatically so that all values are displayed.

Is there an option to get this behaviour by default ? I would prefer not to have to pass an option to TH1::Draw, nor call TAxis::SetRangeUser

many thanks,

Colin

I’m using root 4.04/02f
/afs/cern.ch/cms/external/lcg/external/root/4.04.02f/slc3_ia32_gcc323/root

Use:

gStyle->SetHistMinimumZero();