Format of numbers in the underflow/overflow table in 2D histograms

Hi,

suppose I have a heavily scaled 2D histogram with underflow and overflow. I want to show this underflow and overflow table in the TPaveStats. This table is shown in terms of the integral, so when these numbers are very small, I see only “0” instead of “0.0001” or the like. How do I change the format of the numbers in that table?

The following code serves as a minimal reproducer:

gStyle->SetOptStat("eiuo");
TH2F* myH = new TH2F("myH", "My histogram;X;Y;Z", 10, 0., 10., 10, 0., 10.);
myH->Fill(5., 5., 1.);
myH->Fill(-5., -5., 1.); // underflow!!
myH->Scale(1e-3);
myH->Draw("colz");

and I get this:

So I’m interested in a way to change the content of this table (encircled in red) to something like this:

-----------------------
| 0      | 0      | 0 |
-----------------------
| 0      | 0.001  | 0 |
-----------------------
| 0.001  | 0      | 0 |
-----------------------

or maybe

---------------------
| 0     | 0     | 0 |
---------------------
| 0     | 1.e-3 | 0 |
---------------------
| 1.e-3 | 0     | 0 |
---------------------

ROOT Version: 6.14/04
Platform: CentOS 7


@couet Unfortunately, there are some places in which ROOT unconditionally uses the “7d” format:

hist/histpainter/src/THistPainter.cxx#L8602
hist/histpainter/src/THistPainter.cxx#L8809
hist/histpainter/src/THistPainter.cxx#L8915 - L8922
hist/histpainter/src/THistPainter.cxx#L9023

I see. I am on it.

I made a PR to solve this issue, With this fix your macro gives the following output:

I let @moneta review the PR and approve it.

Thanks Olivier!

1 Like

The PR is merged.

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