Hello All,
I am new to Root and python plotting. I am trying to plot histograms from multiple root files. Each Root file has tTree(Y) with one branch named X. I would like to plot the original histograms along with ratio plots (i.e. ratio of the branch (X) from all root files w.r.t branch (X) from first root file).
I have two questions:
1) I tried to copy an example from the ROOT forum (ROOT: tutorials/hist/ratioplot1.py File Reference) and run it using python3 on my bash. I do not see any output. What am I missing?
2) I tried to plot histograms and ratio plots myself. I want to put all ratio plots in a list and then call the list with for loop to draw all plots. However I am unable to set the legend size, titles, etc for my ratio plots after/under for the loop. Can somebody please help me to fix this?
Here is a snippet of my code
pad2 = ROOT.TPad("pad2", "pad2", 0, 0.05, 1, 0.3)
pad2.SetTopMargin(0) # joins upper and lower plot
pad2.SetLeftMargin(0.15)
pad2.SetBottomMargin(0.2)
# pad2.SetGridx()
pad2.Draw()
pad2.cd()
ratio_plot_list=[R1,R2,R3,R4,R5]
for ratio_plot in ratio_plot_list:
ratio_plot.SetTitle("")
ratio_plot.SetStats(0)
ratio_plot.SetMaximum(1.5)
ratio_plot.SetMinimum(0.5)
ratio_plot.GetYaxis().SetNdivisions(10)
ratio_plot.GetYaxis().SetNdivisions(10)
ratio_plot.GetYaxis().SetLabelSize(21)
ratio_plot.GetXaxis().SetTitleSize(21)
ratio_plot.GetXaxis().SetTitleFont(42)
ratio_plot.GetXaxis().SetTitleOffset(0.4)
ratio_plot.Draw("hist""SAME")
c.cd()
c.Draw()