# Plotting a root output in the same canvas

**URL:** <https://root-forum.cern.ch/t/plotting-a-root-output-in-the-same-canvas/55204>\
**Category:** Newbie\
**Tags:** tree, root\
**Created:** [June 6, 2023, 2:53pm UTC](https://root-forum.cern.ch/t/plotting-a-root-output-in-the-same-canvas/55204 "2023-06-06T14:53:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MC\_w](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mc_w/32/38525_2.png) [@MC\_w](https://root-forum.cern.ch/u/MC_w)\
**Post date:** [June 6, 2023, 2:53pm UTC](https://root-forum.cern.ch/t/plotting-a-root-output-in-the-same-canvas/55204/1 "2023-06-06T14:53:59Z")

</div>

Hi,

I’ve been going through the forum for a while but this is my first question. I’m very new to root. My issue is with plotting the results of a simulation. My output is made of an outtree, from which I plot the “Ener1” leaf with the command (I attach a screen if it can help):

outTree-\>Draw(“Ener1\>\>h1(4096,0,1000”)

Now, if I would like to plot another output in the same canvas, but if I do:

outTree-\>Draw("Ener1\>\>h1(4096,0,1000"“SAME”)

I don’t get the result I want. I’ve tried with THStack or MultiGraph, but with no luck.

How can I solve my problem?  
Thank you,  
Matteo

 ![question](https://root-forum.cern.ch/uploads/default/original/3X/8/f/8f46ef6caa265da88fc94c22699acad4091072f1.png)

\_ROOT Version:\_6.26/06

---

<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:** [June 6, 2023, 2:59pm UTC](https://root-forum.cern.ch/t/plotting-a-root-output-in-the-same-canvas/55204/2 "2023-06-06T14:59:17Z")

</div>

```auto
outTree->Draw("Ener1>>h1(4096,0,1000)");
outTree->Draw("Ener1>>h1(4096,0,1000)", "", "SAME");

```

---

<div class="post-metadata">

**Author:** ![MC\_w](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mc_w/32/38525_2.png) [@MC\_w](https://root-forum.cern.ch/u/MC_w)\
**Post date:** [June 6, 2023, 3:04pm UTC](https://root-forum.cern.ch/t/plotting-a-root-output-in-the-same-canvas/55204/3 "2023-06-06T15:04:38Z")

</div>

Thank you very much,

Matteo
