Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
rmarker.cxx
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_rcanvas
3///
4/// This ROOT 7 example shows the various marker styles.
5///
6/// \macro_image (rcanvas_js)
7/// \macro_code
8///
9/// \date 2018-03-18
10/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
11/// is welcome!
12/// \author Iliana Betsou
13
14#include "ROOT/RCanvas.hxx"
15#include "ROOT/RText.hxx"
16#include "ROOT/RMarker.hxx"
17#include <string>
18
19void rmarker()
20{
21 using namespace ROOT::Experimental;
22
23 auto canvas = RCanvas::Create("RMarker styles");
24 double num = 0.3;
25
26 double x = 0;
27 double dx = 1/16.0;
28 for (int i = 1; i < 16; i++) {
29 x += dx;
30 for (int row=0;row<3;++row) {
31 int style = i;
32
33 if (row == 1)
34 style += 19;
35 else if (row==2)
36 style += 34;
37
38 RPadPos pt(RPadLength::Normal(x), .17_normal + 0.3_normal*row);
39 auto text = canvas->Draw<RText>(pt, std::to_string(style));
40 text->text.font = RAttrFont::kVerdana;
41 text->text.size = 0.05;
42 text->text.align = RAttrText::kCenterTop;
43 text->text.color = RColor::kGreen;
44
45 RPadPos pm(RPadLength::Normal(x), .25_normal + 0.3_normal*row);
46 auto draw = canvas->Draw<RMarker>(pm);
47 draw->marker.style = (RAttrMarker::EStyle) style;
48 draw->marker.color = RColor::kBlue;
49 draw->marker.size = 0.1; // relative to pad height
50 }
51 }
52
53 canvas->Show();
54}
A position (horizontal and vertical) in a RPad.
Definition RPadPos.hxx:28
void Show()
Show canvas.
Definition TCanvas.cxx:2238
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:267
TPaveText * pt
TText * text
Double_t x[n]
Definition legend1.C:17
TCanvas * style()
Definition style.C:1