# TLegend::SetEntrySeparation

Hi - I am finding that TLegend::SetEntrySeparation does not work for me. Is it supposed to change the vertical spacing between entries? I’m using ROOT 4.00/08.

The test files are here:

its.caltech.edu/~edward/test.tgz

and you can run the test:

.x create1DTest.cc(“leptonE”,“temp.root”,entryseparation);

and play around with the entryseparation value. I tried values ranging for 0 to 50. No difference seen.

Thanks.

-Ed

Ed,

Olivier will investigate thsi problem as soon as he is back at CERN.

Rene

I must admit I do not really understand the purpose of this parameter (it is not documented). In the TLegend code it is used the following way:

if ( textsize == 0 ) {
textsize = ( 1. - fEntrySeparation ) * yspace;
....

I checked in the CVS history and found it has always been that way. So the author did that on purpose.

When the text size is 0 it is used as a scale factor to compute the size of text entries. In your example you define a text size. So the text size is not zero. That’s why this parameter had no effect for you. The bigger this parameter is, the smaller the text entries are. I have done a simpler example to show you how it works. Modify the parameter value and you will see the change:

{
TH1F *h1=new TH1F("h1","h1",5,0,5);
h1->SetFillStyle(3004);
h1->SetFillColor(1);
h1->Fill(3);
h1->Draw();

TH1F *h2=new TH1F("h2","h2",5,0,5);
h2->SetFillStyle(3005);
h2->SetFillColor(1);
h2->Fill(2);
h2->Draw("SAME");

TLegend *leg=new TLegend(0.2,0.2,0.4,0.4);
leg->SetEntrySeparation(0.1);
leg->Draw();
}

Seems to me SetEntrySeparation acts a bit like SetTextSize.

May be we should change the way this parameter is used in such way it will really acts on the Entry Separation and not on the text size ? … Note we have to be careful of the side effects.

I find that TLegend::SetEntrySeparation() still does not do what one would expect (ROOT 6.02.10). Is there a way to change the vertical separation in a crowded legend?

Best,
Christian

Can you post a Jira Ticket (bug report) with a small reproducer ?