# Stacking Histos with different Y-axis limits

**URL:** <https://root-forum.cern.ch/t/stacking-histos-with-different-y-axis-limits/46951>\
**Category:** Newbie\
**Created:** [September 23, 2021, 9:28am UTC](https://root-forum.cern.ch/t/stacking-histos-with-different-y-axis-limits/46951 "2021-09-23T09:28:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aya\_Beshr](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/aya_beshr/32/27192_2.png) [@Aya\_Beshr](https://root-forum.cern.ch/u/Aya_Beshr)\
**Post date:** [September 23, 2021, 9:28am UTC](https://root-forum.cern.ch/t/stacking-histos-with-different-y-axis-limits/46951/1 "2021-09-23T09:28:23Z")

</div>

Dear ROOT Experts,

I have several root files including TH1 histograms. I am adding multiple histograms in one canvas, but I am facing a problem each histo has different limits for y-axis (representing number of events) some are large hundreds & the other are \< 1, so I am getting the added histos shape not clear at all. How could I do this properly to get a clear shape for all histos I added.

I have uploded the macro I used and an e.g as png

Thanks alot,  
Aya

[stack\_histos.C](https://root-forum.cern.ch/uploads/short-url/lqUFycjsVmlOVHUiwOgbelmVmDe.C) (1.9 KB)

 ![stack_histos](https://root-forum.cern.ch/uploads/default/original/3X/f/d/fd2fb5861fa0e8df4d2d597ff87f565a5f624785.png)

---

<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:** [September 23, 2021, 9:29am UTC](https://root-forum.cern.ch/t/stacking-histos-with-different-y-axis-limits/46951/2 "2021-09-23T09:29:57Z")

</div>

[THStack](https://root.cern/doc/master/classTHStack.html)

---

<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:** [September 24, 2021, 6:20am UTC](https://root-forum.cern.ch/t/stacking-histos-with-different-y-axis-limits/46951/3 "2021-09-24T06:20:05Z")

</div>

Note also that, given the huge range difference between the red histogram and the green and blue ones, you might need (in addition to THStack) to turn the Y axis into log scale in order to see the red histogram.

---

<div class="post-metadata">

**Author:** ![Aya\_Beshr](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/aya_beshr/32/27192_2.png) [@Aya\_Beshr](https://root-forum.cern.ch/u/Aya_Beshr)\
**Post date:** [September 26, 2021, 2:15am UTC](https://root-forum.cern.ch/t/stacking-histos-with-different-y-axis-limits/46951/4 "2021-09-26T02:15:49Z")

</div>

Thanks a lot!

Aya
