Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
ratioplot6.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_hist
3 /// \notebook
4 /// Example showing a fit residual plot, where the separation margin has been set to 0.
5 /// The last label of the lower plot's y axis is hidden automatically.
6 ///
7 /// \macro_image
8 /// \macro_code
9 ///
10 /// \author Paul Gessinger
11 
12 void ratioplot6() {
13  gStyle->SetOptStat(0);
14  auto c1 = new TCanvas("c1", "fit residual simple");
15  gPad->SetFrameFillStyle(0);
16  auto h1 = new TH1D("h1", "h1", 50, -5, 5);
17  h1->FillRandom("gaus", 5000);
18  TFitResultPtr fitres = h1->Fit("gaus", "S0");
19  h1->Sumw2();
20  h1->GetXaxis()->SetTitle("x");
21  h1->GetYaxis()->SetTitle("y");
22  auto rp1 = new TRatioPlot(h1, "errfunc");
23  rp1->SetGraphDrawOpt("L");
24  rp1->SetSeparationMargin(0.0);
25  rp1->Draw();
26  rp1->GetLowerRefGraph()->SetMinimum(-2);
27  rp1->GetLowerRefGraph()->SetMaximum(2);
28 }