Add entry to legend

Dear all,
How can I define and add mean value, RMS and chi-squared to a legend l?

Thanks in advance


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


TStyle::SetOptStat
TStyle::SetOptFit

How can I actually add (for example) mean value of h histogram in TLegend. I did this:

TH1F *h = new TH1F(*hist);
double mean = h->GetMean();
auto legend = new TLegend(0.1,0.7,0.48,0.9);
legend->AddEntry(h, "data", "l");
legend->AddEntry(mean, "Mean value", ""),

But it`s not working

legend->AddEntry((TObject*)0, TString::Format("Mean value = %g", h->GetMean()), "");

Thanks a lot :smiley:

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