Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
macro2.C
Go to the documentation of this file.
1// Reads the points from a file and produces a simple graph.
2int macro2(){
3 auto c=new TCanvas();c->SetGrid();
4
5 TGraphErrors graph_expected("./macro2_input_expected.txt",
6 "%lg %lg %lg");
7 graph_expected.SetTitle(
8 "Measurement XYZ and Expectation;"
9 "length [cm];"
10 "Arb.Units");
11 graph_expected.SetFillColor(kYellow);
12 graph_expected.DrawClone("E3AL"); // E3 draws the band
13
14 TGraphErrors graph("./macro2_input.txt","%lg %lg %lg");
15 graph.SetMarkerStyle(kCircle);
16 graph.SetFillColor(0);
17 graph.DrawClone("PESame");
18
19 // Draw the Legend
20 TLegend leg(.1,.7,.3,.9,"Lab. Lesson 2");
21 leg.SetFillColor(0);
22 leg.AddEntry(&graph_expected,"Expected Points");
23 leg.AddEntry(&graph,"Measured Points");
24 leg.DrawClone("Same");
25
26 graph.Print();
27 return 0;
28}
#define c(i)
Definition RSha256.hxx:101
@ kYellow
Definition Rtypes.h:67
@ kCircle
Definition TAttMarker.h:58
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:40
The Canvas class.
Definition TCanvas.h:23
A TGraphErrors is a TGraph with error bars.
void SetTitle(const char *title="") override
Change (i.e.
Definition TGraph.cxx:2442
This class displays a legend box (TPaveText) containing several legend entries.
Definition TLegend.h:23
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
Definition TObject.cxx:319
leg
Definition legend1.C:34
int macro2()
Definition macro2.C:2