# Plotting Ntuple Components on a single Canvas

**URL:** <https://root-forum.cern.ch/t/plotting-ntuple-components-on-a-single-canvas/37168>\
**Category:** Newbie\
**Created:** [December 11, 2019, 9:52pm UTC](https://root-forum.cern.ch/t/plotting-ntuple-components-on-a-single-canvas/37168 "2019-12-11T21:52:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![theyellowdog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/theyellowdog/32/20460_2.png) [@theyellowdog](https://root-forum.cern.ch/u/theyellowdog)\
**Post date:** [December 11, 2019, 9:52pm UTC](https://root-forum.cern.ch/t/plotting-ntuple-components-on-a-single-canvas/37168/1 "2019-12-11T21:52:29Z")

</div>

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.

```auto

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

* * *

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [December 12, 2019, 8:28am UTC](https://root-forum.cern.ch/t/plotting-ntuple-components-on-a-single-canvas/37168/2 "2019-12-12T08:28:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![theyellowdog](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/theyellowdog/32/20460_2.png) [@theyellowdog](https://root-forum.cern.ch/u/theyellowdog)\
**Post date:** [December 12, 2019, 6:05pm UTC](https://root-forum.cern.ch/t/plotting-ntuple-components-on-a-single-canvas/37168/3 "2019-12-12T18:05:44Z")

</div>

Thanks it worked.

```auto

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()

```

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [December 13, 2019, 7:25am UTC](https://root-forum.cern.ch/t/plotting-ntuple-components-on-a-single-canvas/37168/4 "2019-12-13T07:25:17Z")

</div>

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