# How to make the Statistics box appear when plotting a THStack (Pyroot)

**URL:** <https://root-forum.cern.ch/t/how-to-make-the-statistics-box-appear-when-plotting-a-thstack-pyroot/51538>\
**Category:** Newbie\
**Created:** [September 11, 2022, 10:10pm UTC](https://root-forum.cern.ch/t/how-to-make-the-statistics-box-appear-when-plotting-a-thstack-pyroot/51538 "2022-09-11T22:10:35Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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 12, 2022, 3:15pm UTC](https://root-forum.cern.ch/t/how-to-make-the-statistics-box-appear-when-plotting-a-thstack-pyroot/51538/3 "2022-09-12T15:15:04Z")

</div>

Some ideas:

> [@TH1F - read and made histogram](https://root-forum.cern.ch/t/th1f-read-and-made-histogram/32801/8):
>
> That’s maybe something for @couet In the meantime, you could try: gStyle-\>SetOptStat(); // just a precaution ((TH1\*)(hs-\>GetStack()-\>Last()))-\>Draw("HIST L"); // the sum hs-\>Draw("SAME HIST L"); or: gStyle-\>SetOptStat(); // just a precaution TH1 \*hl = ((TH1\*)(hs-\>GetStack()-\>Last())); // the sum hl-\>SetNameTitle("MyName", "my title;my X axis;my Y axis"); hl-\>Draw("HIST L"); hs-\>Draw("SAME HIST L"); where, instead of: hl-\>SetNameTitle("MyName", "my title;my X axis;my Y axis"); you could us…

> [@SetRangeUser and SetTitle working with THStacks and TH1F obj](https://root-forum.cern.ch/t/setrangeuser-and-settitle-working-with-thstacks-and-th1f-obj/12114/4):
>
> void stacktest() { gStyle-\>SetHistTopMargin(0); TCanvas c("c","c"); gPad-\>SetLeftMargin(0.35); TH1F\* h1 = new TH1F("h1","h1",50,-5,5); TH1F\* h2 = new TH1F("h2","h2",50,-5,5); TH1F\* h3 = new TH1F("h3","h3",50,-5,5); h1-\>FillRandom("gaus",13000); h2-\>FillRandom("gaus",20000); h3-\>FillRandom("gaus",35000); h1-\>SetFillColor(kRed); h2-\>SetFillColor(kAzure); h3-\>SetFillColor(kYellow); THStack\* hs = new THStack("hs","hs"); #if 1 /\* 0 or 1 \*/ hs-\>Add(h1); hs-\>…

---

_[View the full topic](https://root-forum.cern.ch/t/how-to-make-the-statistics-box-appear-when-plotting-a-thstack-pyroot/51538)._
