forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
macro2.C
28 lines (24 loc) · 854 Bytes
/
macro2.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Reads the points from a file and produces a simple graph.
int macro2(){
auto c=new TCanvas();c->SetGrid();
TGraphErrors graph_expected("./macro2_input_expected.txt",
"%lg %lg %lg");
graph_expected.SetTitle(
"Measurement XYZ and Expectation;"
"lenght [cm];"
"Arb.Units");
graph_expected.SetFillColor(kYellow);
graph_expected.DrawClone("E3AL"); // E3 draws the band
TGraphErrors graph("./macro2_input.txt","%lg %lg %lg");
graph.SetMarkerStyle(kCircle);
graph.SetFillColor(0);
graph.DrawClone("PESame");
// Draw the Legend
TLegend leg(.1,.7,.3,.9,"Lab. Lesson 2");
leg.SetFillColor(0);
leg.AddEntry(&graph_expected,"Expected Points");
leg.AddEntry(&graph,"Measured Points");
leg.DrawClone("Same");
graph.Print();
return 0;
}