How to change statistics box text size?

Here is a simple question: How do I change the size of the numbers a histogram statistics box? Poking around the tutorials, howtos, and the ROOT class categories webpage I get the idea that I might change the size with the function

gStyle->SetStatFontSize( XXXX );

However, calling this function has no effect on the statistics box font size. I see that I can change the “StatFontSize” by checking with gStyle->GetStatFontSize(), which is nice, but still has not solved my problem.

To this points out a problem with the ROOT documentation which is quite nice in some respects, but seems to be lacking a complete reference manual. The class categories web page would seem to list all available class methods, but does not always describe their function. Hence, one is left to guess their function by their name and do a lot of trial and error programming.

As far as I can see, the only way to learn about the how to do a given task in ROOT is to poke around various example scripts and hope that you find an example of what you want to do. (Or you write to this forum to ask trivial questions.)

For example, I also want to change the size of my histogram label on a plot. I see that histogram label size is not controlled by the TStyle class, but that within the histogram class there is the function:

SetLabelSize( 100, “axis” );

However, this function probably applies to changing the axis label sizes, since it takes an axis parameter. Also if I actually call this function (with a histogram pointer), my script hangs and I must ^C out of it.

You really want to change only the size of the text in the box rather than the size of the whole static box?

  1. Interactive, right click on the TPaveStats box, select SetTextAttributes
  2. gStyle->SetStatW(0.5); gStyle->SetStatH(0.5); before creating the histogram. Histogram->UseCurrentStyle is not working for me here, I still wonder why.
  3. TPaveStats *s = (TPaveStats*) gPad->GetPrimitive("stats"); s->SetTextSize(0.1); s->SetX1NDC(0.5); s->SetY1NDC(0.5);