# 1D-Histrogram with defined bins number and bin width

**URL:** <https://root-forum.cern.ch/t/1d-histrogram-with-defined-bins-number-and-bin-width/41882>\
**Category:** Newbie\
**Tags:** hist\
**Created:** [October 16, 2020, 10:13am UTC](https://root-forum.cern.ch/t/1d-histrogram-with-defined-bins-number-and-bin-width/41882 "2020-10-16T10:13:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeppeSpa](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/58956e/32.png) [@PeppeSpa](https://root-forum.cern.ch/u/PeppeSpa)\
**Post date:** [October 16, 2020, 10:13am UTC](https://root-forum.cern.ch/t/1d-histrogram-with-defined-bins-number-and-bin-width/41882/1 "2020-10-16T10:13:44Z")

</div>

Hello,

I am new to Root. I want to plot a 1d histogram from a text file and I want the number of bins to be independent from the x-range.

I have 3 conditions:

- I do not want to set an x range
- I want to use 1000 bins
- I want to set the bin width to specific value

I really appreciate if you can help on this!

_ROOT Version:_ v6-10-04  
_Platform:_ Not Provided  
_Compiler:_ Not Provided

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [October 16, 2020, 10:50am UTC](https://root-forum.cern.ch/t/1d-histrogram-with-defined-bins-number-and-bin-width/41882/2 "2020-10-16T10:50:09Z")

</div>

Hello,

I would suggest to start by looking at the TH1 documentation:

> **[ROOT: TH1 Class Reference](https://root.cern.ch/doc/master/classTH1.html)**

or the ROOT manual:

> **[Histograms](https://root.cern/manual/histograms/)**
>
> Data Analysis Framework

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [October 16, 2020, 10:51am UTC](https://root-forum.cern.ch/t/1d-histrogram-with-defined-bins-number-and-bin-width/41882/3 "2020-10-16T10:51:08Z")

</div>

Also this link can be useful:

> **[Chapter: Histograms](https://root.cern.ch/root/htmldoc/guides/users-guide/Histograms.html)**
