# Adding stats box to legend

**URL:** <https://root-forum.cern.ch/t/adding-stats-box-to-legend/48306>\
**Category:** Newbie\
**Tags:** hist, root\
**Created:** [January 8, 2022, 4:18pm UTC](https://root-forum.cern.ch/t/adding-stats-box-to-legend/48306 "2022-01-08T16:18:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Voldemort](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/voldemort/32/28433_2.png) [@Voldemort](https://root-forum.cern.ch/u/Voldemort)\
**Post date:** [January 8, 2022, 4:18pm UTC](https://root-forum.cern.ch/t/adding-stats-box-to-legend/48306/1 "2022-01-08T16:18:04Z")

</div>

Is it possible to put stat box info in the legend? instead of having them in two separate boxes?

---

<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:** [January 9, 2022, 7:29am UTC](https://root-forum.cern.ch/t/adding-stats-box-to-legend/48306/2 "2022-01-09T07:29:21Z")

</div>

That’s some dark magic you’re trying to do, Lord V 🙂  
If you look at the documentation and member functions of [TLegend](https://root.cern/doc/v608/classTLegend.html), you can add a title (SetHeader) and entries (SetEntry).  
You could get the statistics information (for histograms, for example, see [TH1](https://root.cern/doc/master/classTH1.html) and scroll down to " Miscellaneous operations"), and add them as entries manually (see the example where pure text is added, passing a null pointer to AddEntry).

---

<div class="post-metadata">

**Author:** ![Voldemort](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/voldemort/32/28433_2.png) [@Voldemort](https://root-forum.cern.ch/u/Voldemort)\
**Post date:** [January 10, 2022, 3:59pm UTC](https://root-forum.cern.ch/t/adding-stats-box-to-legend/48306/3 "2022-01-10T15:59:12Z")

</div>

Thank you, thank you! I shall give that a try 🙂
