13 from ROOT
import TCanvas, TColor, TGaxis, TH1F, TPad
14 from ROOT
import kBlack, kBlue, kRed
18 h1 =
TH1F(
"h1", (
"Two gaussian plots and their ratio; x title; h1 and h2" 19 " histograms"), 100, -5, 5)
20 h1.SetLineColor(kBlue+1)
23 h1.GetYaxis().SetTitleSize(20)
24 h1.GetYaxis().SetTitleFont(43)
25 h1.GetYaxis().SetTitleOffset(1.55)
31 h2 =
TH1F(
"h2",
"h2", 100, -5, 5)
38 def createRatio(h1, h2):
40 h3.SetLineColor(kBlack)
52 y.SetTitle(
"ratio h1/h2 ")
56 y.SetTitleOffset(1.55)
71 def createCanvasPads():
72 c =
TCanvas(
"c",
"canvas", 800, 800)
74 pad1 =
TPad(
"pad1",
"pad1", 0, 0.3, 1, 1.0)
75 pad1.SetBottomMargin(0)
80 pad2 =
TPad(
"pad2",
"pad2", 0, 0.05, 1, 0.3)
82 pad2.SetBottomMargin(0.2)
93 h3 = createRatio(h1, h2)
94 c, pad1, pad2 = createCanvasPads()
101 h1.GetYaxis().SetLabelSize(0.0)
102 axis =
TGaxis(-5, 20, -5, 220, 20, 220, 510,
"")
103 axis.SetLabelFont(43)
104 axis.SetLabelSize(15)
113 if __name__ ==
"__main__":
1-D histogram with a float per channel (see TH1 documentation)}
The most important graphics class in the ROOT system.