Hello,

I’m drawing a 2d histogram using the “TEXT” option. I get the # of sig digits via gStyle->SetPaintTextFormat(“5.2g”); but would like to suppress bins with 0 entries. How can I do that?

Thanks in advance,

Tae Min

Hello,

I’m drawing a 2d histogram using the “TEXT” option. I get the # of sig digits via gStyle->SetPaintTextFormat(“5.2g”); but would like to suppress bins with 0 entries. How can I do that?

Thanks in advance,

Tae Min

[quote]but would like to suppress bins with 0 entries[/quote]what do you mean ? bins with content 0 does not drawing(printing). Anyway try:```
h2d->SetMinimum(1.0);
h2d->Draw("TEXT");
```

Jan

0 are not drawn anymore. See: root.cern.ch/root/html/THistPainter.html#HP15

Very likely you are using an old ROOT version.

Hi, I have a bunch of correlation matrices that would look better if I could display the bins with 0 using “TEXT”. Is there any way to reactivate it in the new ROOT versions? I am working with v5.26. Here is what one the matrices look like for now:

This is an excellent example where empty cells must be drawn.

I have modified THistPainter::PaintText such that when gStyle->SetHistMinimumZero() has been called before cells with zeros will also be drawn.

Thanks for this posting.

Rene

1 Like