Hello Forum Colleagues,
I believe the usual way to make the stat box with the fit parameters and stats is to use the command “gStyle->SetOptFit(1)”. However, it seems to have no effect on the section of the code below:

gROOT->SetStyle("Plain"); //set plain TStyle
gStyle->SetOptStat(0); //draw statistics on plots, 0 for no output
gStyle->SetOptStat(111111); //draw statistics on plots, 0 for no output
gStyle->SetOptFit(1); //draw fit results on plot, 0 for no output
gStyle->SetPalette(57); //set color map
gStyle->SetOptTitle(0); //suppress title box
TCanvas c;
// draw fit including the error band
c.Divide(2, 2);
for (unsigned i = 0; i < nmodels; ++i) {
c.cd(i + 1);
models[i]->DrawFit();
}
c.Print("/home/riclambo/Desktop/bat_27_06_345/C6_data/data-all-band.pdf");
// draw data and all fits in the same plot (w/o error bands)
c.Clear();
c.cd(1);
gr.SetMarkerStyle(20);
gr.SetMarkerSize(.5);
gr.GetXaxis()->SetTitle("cos(#theta)");
gr.GetYaxis()->SetTitle("C6 (meV #AA^{6})");
gr.Draw("ap");
for (unsigned i = 0; i < nmodels; ++i) {
models[i]->GetFitFunction().SetLineColor(i + 1);
models[i]->GetFitFunction().SetLineWidth(2);
models[i]->GetFitFunction().GetXaxis()->SetTitle("cos(#theta)");
models[i]->GetFitFunction().GetYaxis()->SetTitle("C6 (meV #AA^{6})");
models[i]->GetFitFunction().Draw("l same");
double chi2_models = models[i]->CalculateChi2(models[i]->GetBestFitParameters());
double pvalue_models = models[i]->CalculatePValue(models[i]->GetBestFitParameters());
cout << "model_chi2" << "\t" << i << "\t" << chi2_models << endl;
cout << "pvalue" << "\t" << i << "\t" <<pvalue_models << "\n" << endl ;
}
c.Print("/home/riclambo/Desktop/bat_27_06_345/C6_data/data-all.pdf");

The poor man workaround would be something like this and Draw the TH1D.
See Convert TGraph to TH1 histogram
However I suspect you will need tweaks to do on the conversion routine if you need to make some sort of error setting or configure weights on th1D.

So, we’re back to the original problem … why can the “stats” be missing?

@Ricardo_Lambo I guess one would need to inspect the “DrawFit” method.
Just to make sure … remember that the “stats” box is “attached” to the graph and NOT to the “fit function”. Moreover, you need to really draw the graph to create its “stats” box. I do not have any example of how to manually create (and draw) a TPaveStats (with fit statistics) when drawing a “fit function” alone.