TH1::Draw() behavior: version 3.10/2 vs. 4.00/8

I use win32gdk on win2k. In version 3.10/2 TH1::Draw(), histograms with all non-negative entries appear with the y-axis minimum set to 0, even if the x-axis was zoomed such that all the displayed bins are greater than zero. - e.g. y-axis is not zero-suppressed. In version 4.00/8, the y-axis is zero-suppressed. My preference is the 3.10/2 behavior. I can call TH1::SetMinimum(0) to get the desired behavior until I go to logy - then I get [ul]Error in THistPainter::PaintInit: log scale requested with zero or negative argument (0.000000)
[/ul] Is there a way to get the 3.10/2 behavior? That is, zero-suppress y-axis only for log-y, not for linear-y? Thanks!


Why don’t you set the minimum to something greater than 0 ? Which is anyway what ROOT is doing automatically when a histogram has its maximum > 0 and its minimum < =0 (in log scale case of course). In a such case the minimum value used is a percentage of the maximum.

When you fix the minimum with SetMinimum, TH1::Paint assumes than the user really wants that value and doesn’t try to find one automatically. So if you set it to something not valid in Log scale you’ll get an error message.

Hi Olivier,

In 3.10/2, the minimum displayed was 0 for lin-y and a percentage of maximum for log-y. In 4.00/8, the minimum appears to be a percentage of maximum in lin-y and log-y. Is there a simple way to get the 3.10/2 behavior in 4.00/8? That is always display y=0 in lin-y, but be smart enough to display ymin = fraction of ymax in log-y? Thanks…


This new behavior appears in version 4 only when you zone along X. If you do not zoom version 3 and 4 are the same, aren’t they ?

I think this improvement has been done on users request (it’s not me who did it, I think it is Rene).

The only way I can imagine to get the old behavior is to set the minimum to 0 in case of LinY and to something being a percentage of the maximum in case of LogY AND Ymin is less or equal to 0.


I was wondering if there is any way to get back the standard 3.x TH1 bahaviour with the minimum y-axis label set to zero. I know, I can use TH1::SetMinimum for each of my histograms, but if one has scripts with several dozen histograms, this is very tedious. Wouldn’t it be possible to add a flag to let’s say TStyle that handles the default setting for the minimum value.




Hi Rene,

on September 1st, 2004 you mentioned that a global option will be implemented to set the behavior of histograms (minimum) as it was
in v.3.xx.
Does such an option exist in Version 4.01/02 or later?

Markus Cristnziani

Yes, thois was implemented in 4.02. See … inimumZero