Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
legend3.C
Go to the documentation of this file.
1{
2 TCanvas *c3 = 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
8
9 leg->AddEntry(h, "Column 1 line 1", "l");
10 leg->AddEntry(h, "Column 2 line 1", "l");
11 leg->AddEntry(h, "Column 1 line 2", "l");
12 leg->AddEntry(h, "Column 2 line 2", "l");
13
15 return c3;
16}
17
The Canvas class.
Definition TCanvas.h:23
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:622
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
This class displays a legend box (TPaveText) containing several legend entries.
Definition TLegend.h:23
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
Definition TLegend.cxx:320
void Draw(Option_t *option="") override
Draw this legend with its current attributes.
Definition TLegend.cxx:425
leg SetNColumns(2)
return c3
Definition legend3.C:15
TLegend * leg
Definition legend3.C:4
TH1 * h
Definition legend3.C:5