Logo ROOT   6.14/05
Reference Guide
lineStyle.cxx
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_v7
3 ///
4 /// \macro_code
5 ///
6 /// \date 2018-03-18
7 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
8 /// is welcome!
9 /// \author Iliana Betsou
10 
11 #include "ROOT/TCanvas.hxx"
12 #include "ROOT/TColor.hxx"
13 #include "ROOT/TText.hxx"
14 #include "ROOT/TLine.hxx"
15 #include "ROOT/TPadPos.hxx"
16 
17 void lineStyle() {
18  using namespace ROOT;
19  using namespace ROOT::Experimental;
20 
21  auto canvas = Experimental::TCanvas::Create("Canvas Title");
22  double num = 0.3;
23 
24  for (int i=10; i>0; i--){
25  num = num + 0.02;
26 
27  TPadPos pt(.3_normal, TPadLength::Normal(num));
28  auto optts = canvas->Draw(Experimental::TText(pt, Form("%d", i)));
29  optts->SetTextSize(13);
30  optts->SetTextAlign(32);
31  optts->SetTextFont(52);
32 
33  TPadPos pl1(.32_normal, TPadLength::Normal(num));
34  TPadPos pl2(.8_normal , TPadLength::Normal(num));
35  auto optls = canvas->Draw(Experimental::TLine(pl1, pl2));
36  optls->SetLineStyle(i);
37  }
38 
39  canvas->Show();
40 }
A normalized coordinate: 0 in the left, bottom corner, 1 in the top, right corner of the TPad...
Definition: TPadLength.hxx:75
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
A position (horizontal and vertical) in a TPad.
Definition: TPadPos.hxx:27
TPaveText * pt
char * Form(const char *fmt,...)
static std::shared_ptr< TCanvas > Create(const std::string &title)
Definition: TCanvas.cxx:74