ROOT
master
Reference Guide
legend2.C
Go to the documentation of this file.
1
{
2
TCanvas
*
c2
=
new
TCanvas
(
"c2"
,
"c2"
,500,300);
3
4
TLegend
*
leg
=
new
TLegend
(0.2, 0.2, .8, .8);
5
TH1
*
h
=
new
TH1F
(
""
,
""
, 1, 0, 1);
6
7
leg
->
AddEntry
(
h
,
"Histogram \"h\""
,
"l"
);
8
leg
->
AddEntry
((
TObject
*)0,
""
,
""
);
9
leg
->
AddEntry
((
TObject
*)0,
"Some text"
,
""
);
10
leg
->
AddEntry
((
TObject
*)0,
""
,
""
);
11
leg
->
AddEntry
(
h
,
"Histogram \"h\" again"
,
"l"
);
12
13
leg
->
Draw
();
14
return
c2
;
15
}
16
h
TH1 * h
Definition:
legend2.C:5
leg
TLegend * leg
Definition:
legend2.C:4
TLegend::AddEntry
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
Definition:
TLegend.cxx:330
TCanvas
The Canvas class.
Definition:
TCanvas.h:23
TH1F
1-D histogram with a float per channel (see TH1 documentation)}
Definition:
TH1.h:575
TObject
Mother of all ROOT objects.
Definition:
TObject.h:37
TH1
TH1 is the base class of all histogram classes in ROOT.
Definition:
TH1.h:58
c2
return c2
Definition:
legend2.C:14
TLegend::Draw
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
Definition:
TLegend.cxx:423
TLegend
This class displays a legend box (TPaveText) containing several legend entries.
Definition:
TLegend.h:23
graf2d
graf
doc
macros
legend2.C
ROOT master - Reference Guide Generated on Thu Feb 25 2021 11:59:57 (GVA Time) using Doxygen 1.9.0