Saving Stat-Options in canvas to root file

Hi,
I’m fitting some TGraph and set the Fit-Options with
gStyle->SetOptFit(1111)

then I’m saving the canvas to a root file:

c->Write()

When I’m opening the canvas in the root file, there are not fit-options.

What is wrong?
Georg


_ROOT Version: 6.26/06


Hi @Georg_T,

could you please provide a small reproducer?
Also, I would recommend to upgrade your ROOT version, e.g. to Root 6.32, as we are constantly fixing bugs and implementing new features.

Monica

Hi Georg,

Here small example:

{
   gStyle->SetOptFit(1111);

   auto h1 = new TH1I("h1", "h1", 100, -5, 5);
   h1->FillRandom("gaus", 1000);
   h1->Fit("gaus");

   // without this line saved canvas will not have desired settings
   gPad->Update();

   gPad->SaveAs("optfit.root");
}

You need to be sure that histogram painted before it saved into the file.
In such case TPaveStats object will be created - with correct settings.

Regards,
Sergey

gPad->Update() does the magic - thanks
Georg

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