ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
statsEditing.C File Reference

Edit statistics box. More...

Go to the source code of this file.

Detailed Description

Edit statistics box.

This example shows:

pict1_statsEditing.C.png
TCanvas *statsEditing() {
// Create and plot a test histogram with stats
TCanvas *se = new TCanvas;
TH1F *h = new TH1F("h","test",100,-3,3);
h->FillRandom("gaus",3000);
h->Draw();
se->Update();
// Retrieve the stat box
TPaveStats *ps = (TPaveStats*)se->GetPrimitive("stats");
ps->SetName("mystats");
TList *list = ps->GetListOfLines();
// Remove the RMS line
TText *tconst = ps->GetLineWith("RMS");
list->Remove(tconst);
// Add a new line in the stat box.
// Note that "=" is a control character
TLatex *myt = new TLatex(0,0,"Test = 10");
myt ->SetTextFont(42);
myt ->SetTextSize(0.04);
list->Add(myt);
// the following line is needed to avoid that the automatic redrawing of stats
h->SetStats(0);
se->Modified();
return se;
}
Author
Olivier Couet

Definition in file statsEditing.C.