Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
statsEditing.C File Reference

Detailed Description

View in nbviewer Open in SWAN
Edit statistics box.

This example shows:

  • how to remove a stat element from the stat box
  • how to add a new one
// 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");
// Remove the RMS line
TText *tconst = ps->GetLineWith("RMS");
listOfLines->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);
myt ->SetTextColor(kRed);
// the following line is needed to avoid that the automatic redrawing of stats
h->SetStats(0);
se->Modified();
return se;
}
#define h(i)
Definition RSha256.hxx:106
@ kRed
Definition Rtypes.h:66
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TStyle * gStyle
Definition TStyle.h:433
The Canvas class.
Definition TCanvas.h:23
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:621
To draw Mathematical Formula.
Definition TLatex.h:18
A doubly linked list.
Definition TList.h:38
The histogram statistics painter class.
Definition TPaveStats.h:18
virtual TList * GetListOfLines() const
Definition TPaveText.h:48
virtual TText * GetLineWith(const char *text) const
Get Pointer to first containing string text in this pavetext.
virtual void SetName(const char *name="")
Definition TPave.h:79
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition TStyle.cxx:1636
Base class for several text objects.
Definition TText.h:22
Author
Olivier Couet

Definition in file statsEditing.C.