TLegend set distance between entry symbol and entry text

Hi,

I am trying to adjust the distance between an entry symbol (i.e. the marker, line, filled box, etc.) and its text in TLegend independent of its margin (i.e. its width). Is this possible somehow?

Cheers,
Ben

What can be set regrading legend geometry is summarise by this example legendgeometry.C (1.4 KB)

Thank you for this clarification. I deduce that it is not possible directly via ROOT. The workaround I am using with pyROOT is

legend = TLegend()
hist = TH1()

entryOption = 'P'
entryTitle = '#kern[-0.2]{ }' + hist.GetTitle()
legend.AddEntry(hist, entryTitle, entryOption)

By adapting the number in the kern, you can adapt the space between the symbol and the text.

Cheers,
Ben

1 Like

Of course the same can be done using C++. For instance:

   auto legend = new TLegend(...);
   auto hist = new TH1(...);
   legend->AddEntry(hist, Form("#kern[-0.2]{ } %s ",hist.GetTitle()), "P");
1 Like

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