# Making multiple plots from a single histogram

**URL:** <https://root-forum.cern.ch/t/making-multiple-plots-from-a-single-histogram/47191>\
**Category:** Newbie\
**Created:** [October 10, 2021, 10:57pm UTC](https://root-forum.cern.ch/t/making-multiple-plots-from-a-single-histogram/47191 "2021-10-10T22:57:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spencer](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/spencer/32/39846_2.png) [@spencer](https://root-forum.cern.ch/u/spencer)\
**Post date:** [October 10, 2021, 10:57pm UTC](https://root-forum.cern.ch/t/making-multiple-plots-from-a-single-histogram/47191/1 "2021-10-10T22:57:45Z")

</div>

Hi,

I am (again) stuck on how to plot information from a single TTree with different cuts, without the second histogram overwriting the first. I want to read in a TTree, and plot a variable. I’d like to plot it without cuts, and then put a second histogram on the same plot, this time applying cuts to the other variables in the TTree. I am able to plot the first histogram successfully. However, when I add in the second, it overwrites the first, even though I have different histogram names. If I uncomment the second FNTuple-\>Draw() comment, then it fills in the first (‘gen’) histogram. How can I plot these two histograms on the same plot, without the two histograms interfering with each other.

I know that this has come up before, but I am cannot figure out how to search for it in the Forum.

Spencer

```auto
TH1F *gen = new TH1F("gen","",40,-8.0,8.0);
FNtuple->Draw("fsrap>>gen");
// Style command removed, to simplify

 gen->Draw();
 
 // current ALICE 

// TH1F *alice = new TH1F("alice","",40,-8.0,8.0);
// FNtuple->Draw("fsrap>>alice","abs(p1prap)<4.0 && abs(p2prap)<4.0 && abs(p3prap)<4.0 && abs(p4prap)<4.0 && p1pt>0.1 && p2pt>0.1 && p3pt>0.1 && p4pt>>0.1");
// alice->Draw("same");

```

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [October 11, 2021, 1:09am UTC](https://root-forum.cern.ch/t/making-multiple-plots-from-a-single-histogram/47191/2 "2021-10-11T01:09:29Z")

</div>

Try adding the option “goff” to `FNtuple->Draw(“fsrap>>alice”...);`.  
[https://root.cern/doc/master/classTTree.html#a73450649dc6e54b5b94516c468523e45](https://root.cern/doc/master/classTTree.html#a73450649dc6e54b5b94516c468523e45)

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [October 11, 2021, 7:07am UTC](https://root-forum.cern.ch/t/making-multiple-plots-from-a-single-histogram/47191/3 "2021-10-11T07:07:37Z")

</div>

Instead of:  
`tree->Draw("varexp >> hname", ...);`  
use:  
`tree->Project("hname", "varexp", ...);`

---

<div class="post-metadata">

**Author:** ![spencer](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/spencer/32/39846_2.png) [@spencer](https://root-forum.cern.ch/u/spencer)\
**Post date:** [October 11, 2021, 3:02pm UTC](https://root-forum.cern.ch/t/making-multiple-plots-from-a-single-histogram/47191/4 "2021-10-11T15:02:12Z")

</div>

Thanks for this help. I tried ‘goff’ first since it was the first response, and it worked.

-Spencer
