5 TH1F *
h1 =
new TH1F(
"h1",
"TLegend Example",200,-10,10);
11 TF1 *
f1=
new TF1(
"f1",
"1000*TMath::Abs(sin(x)/x)",-10,10);
20 y[i] = 1000*sin(
x[i]+0.2);
35 leg->SetHeader(
"The Legend Title");
36 leg->AddEntry(
h1,
"Histogram filled with random numbers",
"f");
37 leg->AddEntry(
"f1",
"Function abs(#frac{sin(x)}{x})",
"l");
38 leg->AddEntry(
"gr",
"Graph with error bars",
"lep");
R__EXTERN TStyle * gStyle
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
void Draw(Option_t *option="") override
Draw this function with its current attributes.
A TGraphErrors is a TGraph with error bars.
void SetName(const char *name="") override
Set graph name.
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
1-D histogram with a float per channel (see TH1 documentation)
virtual void FillRandom(const char *fname, Int_t ntimes=5000, TRandom *rng=nullptr)
Fill histogram following distribution in function fname.
void Draw(Option_t *option="") override
Draw this histogram with options.
This class displays a legend box (TPaveText) containing several legend entries.
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...