Error bars on bar plot when Sumw2() used?

Dear ROOT experts,

I just stumbled across something strange. When drawing a TH1 with the “BAR” option, error bars appear on top of it when Sumw2() is also used. If Sumw2() is never called for the histogram, no error bars are shown. Also, when drawing with the “HBAR” option no error bars appear.

This probably is not intentional, is it? If it is, should I have found this documented somewhere?

This behaviour occurs in v5.12.00 and still in v5.16.00. The snippet below reproduces it.


  TH1D hist("hist", "hist", 10, 0., 1.);





hist.Draw("BAR"); by


Well, not really. The effect of drawing with “BAR hist” is that the “hist” option is used to draw the histogram, and it looks like the “BAR” option is skipped completely. This means that one does not obtain bars with width and offset ruled by SetBarWidth() and SetBarOffset(), but just a bar over the full bin width.

Apart from that the real questions are:

  • Why only draw errors (and the markers, by the way) if Sumw2() is called? Without this, the errors still exist.
  • Why not draw errors for the “HBAR” option? They would make just as much sense as for the “BAR” case.


Sorry, I was too fast in my reply. We will fix these inconsistencies.


I see this behavior in 5.17 too. I will fix it.
You said it behaves this way since 5.12. Do you remember if it was behaving differently before 5.12 ?

I don’t remember if it ever behaved differently actually. I just checked with v4.04/02 on my laptop (OS X 10.4.10) and there the behaviour is exactly the same. I probably just never ran into the `right’ combination of settings to see this.


I have fixed the problem. The option HIST now works with option BAr also as described in the THistPainter::Paint() method.: