Order of printed parameters in stat box

Hello, does anybody know how can i change the order of the fit results shown in the stats box? I can see they are printed out alphabetically but I would like to customize the order. I wuld also like to change the title if possible.
Thanks :slight_smile:

Not sure about how to re-order lines (maybe @couet knows), but for the title, starting from the statsEditing.8C tutorial, you can try something like:

   // Retrieve the stat box
   TPaveStats *ps = (TPaveStats*)canvas->GetPrimitive("stats");
   ps->SetName("mystats");
   TText *tconst = ps->GetLine(0);
   tconst->SetTitle("your new title");
   // the following line is needed to avoid that the automatic redrawing of stats
   h->SetStats(0);
   canvas->Modified();

See the example on “Statistics box editing”:
https://root.cern/doc/master/classTPaveStats.html#PS03
In short, you get a TList of the entries and then you can Add or Remove lines as you want; if you are going to move around many, it may be easier to just create your own TPaveStats. Note that you will have to enter the values yourself, since there’s no function to “add the RMS entry”, etc.; you add the text you want.

1 Like