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
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
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
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");
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.