TLegend not displaying entries


ROOT Version: 6.14.00
Platform: Mac OSX
Compiler: GCC/Clang


This question is very similar to TLegend not displaying entries but entries are in dump of TLegend and list of primitives but I’ve hit this again somehow. And I can’t comment on the original post since it’s locked after 14 days which is really short, but anyway…

Please have a look at this attachment which is a canvas made from a lot of ROOT.HistStack / ROOT.Hist / ROOT.TLegend.AddEntry() calls.

bjets_n.root (11.7 KB)

One thing I’ve noticed is that when I open the editor for the TLegend and change the opacity around, things start popping up or disappearing. I see lots of TQuartz errors such as:

Error in TGQuartz::DrawFillArea: Could not find TColor for index 1180
Error in TGQuartz::DrawFillArea: Could not find TColor for index 1181
Error in TGQuartz::DrawFillArea: Could not find TColor for index 1182
Error in TGQuartz::DrawFillArea: Could not find TColor for index 1183

So it seems like something is off here. Any suggestions on what I could try? It’s very hard to provide a MWE as this is part of plotting code in python.

If I save as a PDF or PNG, this is the resulting output: bjets_n.pdf (16.8 KB)

It’s really not clear to me what’s going on with the plotting at all here. There’s additionally a giant black box associated with the TLegend at the top right that’s also showing up, which seems to imply some sort of issue in rendering.

Looks like it’s an issue with the text size. Did the units for the text size change? I think it used to work with pixels, but now it seems to be relative? In any case, consider this noise…

@couet could you take a look?

It is actually a problem with the text size:
You can give the text size in both pixels and relative to the current pad. Which definition is used depends on the Text Font.
The Text Font is defined as the sum of the Fontnumber (in your case 6) times 10 and the precision (in your case 2) so overall 62 in your case. The 2 means that Root interprets the text size realtive to the current pad. Since you have set 14 there, your text is 14 times as high as the pad.
I assume you meant to give the text size in pixels. In this case the precision has to be 3 which means that the text size is given in pixels.

Therefore changing your Font to 63 should solve the problem.
You can find further information on how Text works in Root here: https://root.cern.ch/doc/master/classTAttText.html#T4

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