15 const int n_points=10;
16 double x_vals[n_points]=
17 {1,2,3,4,5,6,7,8,9,10};
18 double y_vals[n_points]=
19 {6,12,14,20,22,24,35,45,44,53};
20 double y_errs[n_points]=
21 {5,5,4.7,4.5,4.2,5.1,2.9,4.1,4.8,5.43};
24 TGraphErrors graph(n_points,x_vals,y_vals,
nullptr,y_errs);
25 graph.SetTitle(
"Measurement XYZ;length [cm];Arb.Units");
29 graph.SetMarkerColor(
kBlue);
30 graph.SetLineColor(
kBlue);
36 graph.DrawClone(
"APE");
39 TF1 f(
"Linear law",
"[0]+x*[1]",.5,10.5);
41 f.SetLineColor(
kRed);
f.SetLineStyle(2);
49 graph.SetFillColor(0);
50 leg.AddEntry(&graph,
"Exp. Points");
51 leg.AddEntry(&
f,
"Th. Law");
52 leg.DrawClone(
"Same");
56 arrow.SetLineWidth(2);
60 TLatex text(8.2,7.5,
"#splitline{Maximum}{Deviation}");
63 mycanvas->Print(
"graph_with_law.pdf");