Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
textalign.C
Go to the documentation of this file.
1{
2 auto *Ta = new TCanvas("Ta","Ta",0,0,500,200);
3 Ta->Range(0,0,1,1);
4
5 auto *lv = new TLine;
6 lv->SetLineStyle(3); lv->SetLineColor(kBlue);
7 lv->DrawLine(0.33,0.0,0.33,1.0);
8 lv->DrawLine(0.6,0.165,1.,0.165);
9 lv->DrawLine(0.6,0.493,1.,0.493);
10 lv->DrawLine(0.6,0.823,1.,0.823);
11
12 // Horizontal alignment.
13 auto *th1 = new TText(0.33,0.165,"Left adjusted");
14 th1->SetTextAlign(11); th1->SetTextSize(0.12);
15 th1->Draw();
16
17 auto *th2 = new TText(0.33,0.493,"Center adjusted");
18 th2->SetTextAlign(21); th2->SetTextSize(0.12);
19 th2->Draw();
20
21 auto *th3 = new TText(0.33,0.823,"Right adjusted");
22 th3->SetTextAlign(31); th3->SetTextSize(0.12);
23 th3->Draw();
24
25 // Vertical alignment.
26 auto *tv1 = new TText(0.66,0.165,"Bottom adjusted");
27 tv1->SetTextAlign(11); tv1->SetTextSize(0.12);
28 tv1->Draw();
29
30 auto *tv2 = new TText(0.66,0.493,"Center adjusted");
31 tv2->SetTextAlign(12); tv2->SetTextSize(0.12);
32 tv2->Draw();
33
34 auto *tv3 = new TText(0.66,0.823,"Top adjusted");
35 tv3->SetTextAlign(13); tv3->SetTextSize(0.12);
36 tv3->Draw();
37}
@ kBlue
Definition Rtypes.h:66
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:42
The Canvas class.
Definition TCanvas.h:23
Use the TLine constructor to create a simple line.
Definition TLine.h:22
Base class for several text objects.
Definition TText.h:22
auto * th3
Definition textalign.C:21
auto * tv3
Definition textalign.C:34
auto * th2
Definition textalign.C:17
auto * tv1
Definition textalign.C:26
auto * lv
Definition textalign.C:5
auto * tv2
Definition textalign.C:30
auto * th1
Definition textalign.C:13