Hello
I am dividing a canvas and then I create and draw a pad for each one of the divided panels. The problem is the only the last pad seems to show up properly. I paste a snippet of my code (to keep it simple I am cutting off the cosmetics etc)
from ROOT import TFile, TH1, kRed, kGreen, kBlue, kBlack, TCanvas, TPad
from ROOT import gSystem, gStyle, gROOT, kTRUE, gDirectory, gPad
from ROOT import TCanvas, TH1D, TH1F, THStack, TFile, TPad, TLegend, TLatex, TLine, TAttMarker, TMarker, TColor
from ROOT import TFile, TTree, TH1D, TCanvas, TLorentzVector, TLatex, kRed, kBlue, kBlack, TLegend, TF1, gStyle, gROOT, THStack, TColor, TPad, gPad
from ROOT import gROOT, THStack
import os, sys
fList=['Results/FEH_2S_Skeleton_Run155_OutSideBox_TapedVTRX_NoGndOnCarrier_module9/Hybrid.root', 'Results/FEH_2S_Skeleton_Run156_OutSideBox_TapedVTRX_WithGndOnCarrier_module9/Hybrid.root','Results/FEH_2S_Skeleton_Run155_OutSideBox_TapedVTRX_NoGndOnCarrier_module9/Hybrid.root', 'Results/FEH_2S_Skeleton_Run156_OutSideBox_TapedVTRX_WithGndOnCarrier_module9/Hybrid.root']
cT = TCanvas('c','c',90,90,W,H)
cT.SetFillColor(0)
cT.SetBorderMode(0)
cT.SetFrameFillStyle(0)
cT.SetFrameBorderMode(0)
cT.SetLeftMargin(L/W)
cT.SetRightMargin(R/W)
cT.SetTopMargin(T/H)
cT.SetBottomMargin(B/H)
cT.Divide(2,2)
H = 900
W = 1600
for i, fIn in enumerate(fList) :
f=TFile(fIn,"read")
f.cd()
# read the four needed histograms for each input file
hLB=f.Get(hLBottom)
hLT=f.Get(hLTop)
hRB=f.Get(hRBottom)
hRT=f.Get(hRTop)
cT.cd(i+1)
cP = TPad('pad',"pad",0.0,0.25,1.0,1.0)
cP.SetLeftMargin(L/W)
cP.SetRightMargin(R/W)
cP.SetTopMargin(T/H)
cP.Draw()
cP.cd()
hLB.Draw('hist')
hLT.Draw("same hist p")
hRT.Draw("same hist p")
hRB.Draw("same hist p")
cP.Update()
cT.Update()
gPad.Update()
gPad.RedrawAxis()
cT.SaveAs("plots.pdf")
cT.Divide(2,2)
plots.pdf (54.1 KB)