Histogram turns into dots after scale


_ROOT Version: 6.19
_Platform: OS 10.14.3


I have a histogram that looks like this average1.pdf (43.6 KB) then I scale it and it looks like this average.pdf (140.3 KB)

I don’t understand what’s happening, I don’t understand if this is change merely in style or if this means something

Hi,
@couet can probably explain the “why”, my reply here should help working around the behavior.

Cheers,
Enrico

Can you explain what you mean by scaling ? I guess zoom on x axis ?
Is it a 1d or 2d histogram ?
which option are you using to draw it ?

It is a simple TH1F histogram

By scaling I mean

h.Scale(k)

If I use:

h.Draw('HIST')

then I get what I want, but then of course I’m saving it as an image, I’d like to visualiza it in that same way in the ROOT browser

If you do not specify any drawing option an histogram with errors is drawn as an error bar plot and you need to use HIST option to not draw it with errors.

You can also suppress the errors by doing:

h->Sumw2(kFALSE);

then you will not need the option HIST.

See also:
https://root.cern.ch/doc/master/classTH1.html#add929909dcb3745f6a52e9ae0860bfbd

There you can see that calling Scale() with the option “nosw2” is equivalent.

Hi Olivier,
I think the surprising behavior here is that calling Scale adds errors to the histogram.

Yes “Scale” adds errors. @moneta should know why

This is normal. If you scale an histogram the bin error cannot be compute anymore as square root of bin content!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.