after this post Editting Statbox in a divided canvas, I encouter the same problem here, with Tgrapherrors.
now i am reading those graphs from a tifile, fit them and put into python array.
then i draw them separately. I cant access the “stats” (it’s a null pointer),
as in the following codes:
file.Open()
graphs = []
for i in range(24):
# gr = file.Get(...)
# gr.SomeFormatting
# gr.Fit()
graphs.append(gr)
c = ROOT.TCanvas("c","c",3600,2400)
c.Divide(6,4)
for i,gr in enumerate(graphs):
sub = c.cd(i+1)
gr.Draw()
print(r.gPad)
gr.Fit(func,"REMQ")
ROOT.gPad.Modified()
ROOT.gPad.Update()
# ROOT.gPad.Modified()
st = gr.FindObject("stats")
st.SetX1NDC(0.6)
st.SetX2NDC(0.9)
st.SetY1NDC(0.7)
st.SetY2NDC(0.9)
ROOT.gPad.Modified()
ROOT.gPad.Update()
c.Draw()
even i did the plot in one single canvas, like this one:
c = ROOT.TCanvas("c","c",3600,2400)
gr=graphs[0]
gr.Draw()
ROOT.gPad.Update()
st = gr.FindObject("stats")
st.SetX1NDC(0.6)
st.SetX2NDC(0.9)
st.SetY1NDC(0.7)
st.SetY2NDC(0.9)
c.Draw()
I tried with different combinations of gPad.Update(), gPad.Modified(), and i havent succeded so far …
ROOT Version: 6.26.00 (conda_forge)
Platform: ubuntu20.04
Compiler: gcc9