# When you don't know the range of the histogram

**URL:** <https://root-forum.cern.ch/t/when-you-dont-know-the-range-of-the-histogram/39835>\
**Category:** Newbie\
**Created:** [June 8, 2020, 4:58pm UTC](https://root-forum.cern.ch/t/when-you-dont-know-the-range-of-the-histogram/39835 "2020-06-08T16:58:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Newbie](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/dc4da7/32.png) [@Newbie](https://root-forum.cern.ch/u/Newbie)\
**Post date:** [June 8, 2020, 4:58pm UTC](https://root-forum.cern.ch/t/when-you-dont-know-the-range-of-the-histogram/39835/1 "2020-06-08T16:58:12Z")

</div>

Dear,

How can you define a TH1 without specifying the range of the x-axis, which should be by default equal to the last entries on the left and right of the histogram?

Thanks!

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [June 8, 2020, 5:14pm UTC](https://root-forum.cern.ch/t/when-you-dont-know-the-range-of-the-histogram/39835/2 "2020-06-08T17:14:43Z")

</div>

Try to set `xmin` and `xmax` to `0`. For example:

```auto
auto h1 = new TH1F("h1", "my histo", 100, 0, 0);

```

---

<div class="post-metadata">

**Author:** ![Newbie](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/dc4da7/32.png) [@Newbie](https://root-forum.cern.ch/u/Newbie)\
**Post date:** [June 8, 2020, 11:02pm UTC](https://root-forum.cern.ch/t/when-you-dont-know-the-range-of-the-histogram/39835/3 "2020-06-08T23:02:11Z")

</div>

Thank you very much!
