TPad::BuildLegend() clarification

Dear Experts,

I have a little doubt on the behaviour of TPad::BuildLegend() method when called without arguments.
At https://root.cern.ch/doc/master/classTLegend.html it is stated that:

   // TPad::BuildLegend() default placement values are such that they trigger
   // the automatic placement.

I am using this method in a class I am writing and I have a doubt.
If I call BuildLegend with no arguments I get the legend in a legit spot, but the entries have black background (SetDrawOption(ā€œPā€) does not do the trick and I want to set fill style and color for each entry only as last option).
If I call BuildLegend with all the arguments, and set the coordinates to the default values, the entries are plotted correctly (they use the ā€œPā€ option Iā€™m providing) but the legend is not plot in a empty spot.

Is the documentation right? Is the automatic placement called without finding an empty spot for the legend or it is using the default arguments directly to place the legend?

Thank you in advance!

gf


ROOT Version: v6-10-06-52-gc54db1c
Platform, compiler: macosx64, clang++


The macro you are referring to in the documentation finds the legend place. May be the doc is not clear enough. Let me check.

1 Like

In BuildLegend when X1 = X2 and Y1 = Y2 (ie a box reduce to a point) then the automatic placement is used. I will make it clearer in the doc. Thanks to have seen it.

Thank you for having check!
Cheers

I have updated the BuildLegend documentation to make it more clear.

1 Like

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