Hi,
In the following code:
import ROOT
ROOT.gStyle.SetOptStat(0)
c=ROOT.TCanvas('c', '', 600, 600)
ROOT.gStyle.SetOptStat('mr')
h=ROOT.TH1F('h', '', 100, 0, 10)
h.FillRandom('gaus', 10000)
h.Draw()
c.SaveAs('plot.png')
The statistics box is by deafault turned off initially. However after I make the canvas and before I make the histogram I request errors with the mean. I get, therefore, the plot I expect. However If I do:
import ROOT
ROOT.gStyle.SetOptStat(0)
c=ROOT.TCanvas('c', '', 600, 600)
h=ROOT.TH1F('h', '', 100, 0, 10)
h.FillRandom('gaus', 10000)
ROOT.gStyle.SetOptStat('mr')
h.Draw()
c.SaveAs('plot.png')
the statistics box is not present. This suggests that the histogram constructor is checking the gStyle instance and either storing information to show the statistics box or not. Is this true? I do not have time to go through the code.
If so, by adding this SetOptStat line after the constructor, the information is not available anymore and the box would not appear even if requested. Calculating these seven or eight numbers should be done always, regarding of wether they are requested or not. At the end seven extra floats won’t occupy much space and allow for all these statistics to be available afterwards.
Cheers.f
Please read tips for efficient and successful posting and posting code
_ROOT Version:6.22.06
_Platform:x86_64-centos7
_Compiler:gcc8