Hi, I have a small problem, which is, when I add an entry to a legend using:
TLegendEntry* l2 = leg->AddEntry(h1, "particle1", "fp");
l2->SetMarkerColor(2);
l2->SetMarkerSize(1);
//l1->SetTextSize(350);
l2->SetMarkerStyle(8);
The entry will be shown but it will inherit the markers style from h1 instead of showing the style I need using the above methods.
Instead of “l2->Set...
”, use “h1->Set...
”.
Hi @Wile_E_Coyote ,
Thanks for your answer. If I change l2 to h1 indeed legend marker will change, however, h1 markers will change too.
What I want (if possible) is to change only the legend marker.
Then don’t add the histogram as entry. You can create a TMarker of the type you want and then add this marker as entry in the TLegend.
TMarker *m = new TMarker(.1,.1,21);
TLegend *leg = new TLegend(0.1,0.7,0.48,0.9);
leg->AddEntry(m,"test","p");
1 Like
Hi @dastudillo,
Nice. This worked fine:
TMarker *m = new TMarker(.1,.1,21);
TLegend *leg = new TLegend(0.1,0.7,0.48,0.9);
m->SetMarkerColor(2);
leg->AddEntry(m,"test","p");
system
Closed
6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.