Problems with TLegend Draw

does anybody have an idea why the legend seems to be printed wrongly? I got histo from root files and used DrawCopy() to draw them. The legend entries were added as leg->AddEntry(“histo name”, “some comment”, “l”). But I cannot see the correct correspondence with histos.



TH1 *h_copy = h->DrawCopy();
leg->AddEntry(h_copy, "some comment", "l");

can you post a small example reproducing the problem ?

Yes, it works… but now I cannot draw the two histos together…

Should I use
h_copy->DrawCopy() for the first one and
h_copy1->DrawCopy(“same”) for the second one?

TH1 *h_1_copy = h_1->DrawCopy();
TH1 *h_2_copy = h_2->DrawCopy("same");
leg->AddEntry(h_1_copy, "some comment", "l");
leg->AddEntry(h_2_copy, "another comment", "l");
1 Like

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