From HandWiki
Jump to: navigation, search


<< Back
1% complete

A most common method to visualize probability distributions is to use Histograms. Histograms can be used to estimate the Probability_distribution using a binned representation, i.e. when we

  1. define range of values we are interpreted in;
  2. divide the entire range of values into a series of intervals (with fixed or variable sizes;
  3. count how many values fall into each interval

Let us illustrate how to create a histogram for a variable in the range [0,1] using fixed bin size, and variable bin size

from ROOT import TH1D
from array import array

# histogram with fixed number of bins
h1=TH1D('test1','test1',100,0,1) # use 100 bins

# variable bins as array 

We have prepared two histogram objects, and we can do some manipulation. The first thing is to fill there two histograms with some random data.