How to choose a bin numbers while plotting a histogram?

I have a set of data need to be plot in a histogram. How should I decide the bin numbers that goes into plotting of the histogram?

Thank you.

_ROOT Version:v5-34-00
Platform: Not Provided
Compiler: Not Provided

There is not precise answer to this question. It clearly depends on what you want to plot or what you want to see. You can try several bin numbers to see the results and choose what it the one you like the most.
To do, type


with β€œt” the name of your TTree, β€œvar1” is the name of your leaf you want to plot, β€œ1000” is the number of bins (you can change this number by another value), xmin and xmax are the minimum and maximum value of the x-axis, β€œcond” represent optional conditions (it may remain empty).

Can you be more precise ? what is the format of your data ? text file ? ROOT tree ? …

I have a set of data in the text file/dat file. The total points are around 300000000, and the points lies between 0 and 1.
My confusion is what bin number i should take(technically i can take any) in order to be more logical.

Thank you.

Thank you. But I am making a histogram by the data generated in the text file/dat file.


1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.