Plotting Ntuple Components on a single Canvas

I have Ntuple which contain data of four variables. (x:y:z:t)

I am trying to draw 4 histogram on a single canvas but only getting a single histogram.


f = ROOT.TFile(filename)
c = ROOT.TCanvas()
c.Divide(2,2)
c.cd(4)
f.n.Draw("t>>h(100,-10,40)","","COLZ")
# finish the drawing in each pad
c.cd(3)
f.n.Draw("z>>h(100,-10,40)","","COLZ")

c.cd(2)
f.n.Draw("y>>h(100,-10,40)","","COLZ")

c.cd(1)
f.n.Draw("x>>h(100,-10,40)","","COLZ")

# Draw the Canvas
c.Draw()

__

ROOT Version: Not Provided
Platform: Python
Compiler: Not Provided


You are filling 4 times the same histogram with different ntuple variables.
Change the histogram name for each Draw command.
Also note that the COLZ option does not apply on 1D histograms.

Thanks it worked.


f = ROOT.TFile(filename)
c = ROOT.TCanvas()
c.Divide(2,2)
c.cd(4)
f.n.Draw("t>>h(100,-10,40)","","COLZ")
# finish the drawing in each pad
c.cd(3)
f.n.Draw("z>>g(100,-10,40)","","COLZ")

c.cd(2)
f.n.Draw("y>>s(100,-10,40)","","COLZ")

c.cd(1)
f.n.Draw("x>>e(100,-10,40)","","COLZ")

# Draw the Canvas
c.Draw()

Again, the COLZ option is not meaningful in case of 1D plots.
Change "COLZ" to ""