Logo ROOT  
Reference Guide
ratioplot4.py
Go to the documentation of this file.
1## \file
2## \ingroup tutorial_hist
3## \notebook
4## Example that shows custom dashed lines on the lower plot, specified by a vector of floats.
5##
6## By default, dashed lines are drawn at certain points. You can either disable them, or specify
7## where you want them to appear.
8## Inspired by the tutorial of Paul Gessinger.
9##
10## \macro_image
11## \macro_code
12##
13## \author Alberto Ferro
14
15import ROOT
16
17ROOT.gStyle.SetOptStat(0)
18
19c1 = ROOT.TCanvas("c1", "fit residual simple")
20h1 = ROOT.TH1D("h1", "h1", 50, -5, 5)
21h1.FillRandom("gaus", 2000)
22h1.Fit("gaus")
23h1.GetXaxis().SetTitle("x")
24h1.GetYaxis().SetTitle("y")
25
26rp1 = ROOT.TRatioPlot(h1)
27
28lines = ROOT.std.vector('double')()
29for i in range(-3,4):lines.push_back(i)
30rp1.SetGridlines(lines)
31
32rp1.Draw()
33rp1.GetLowerRefGraph().SetMinimum(-4)
34rp1.GetLowerRefGraph().SetMaximum(4)
35
36c1.Update()