``` weights1 = np.ones_like(x1) weights2 = np.ones_like(x1)/float(len(x1)) ```

• np.ones_like(x1) crates an array of ones with the same size as x1
• np.ones_like(x1)/float(len(x1)) crates an array of ones with the same size as x1 divided by the length of the array

To display the content of x1 we store and plot them in a histogram. A histogram can be thought of as a set of bins. Each element of an array (x1 or x2 ) is entered into one and only one of these bins.

 ``` plt.hist(x1,bins=10,range=(0.0,10.0),histtype='stepfilled',color='green') ```

Here you are plotting a histogram using matplotlib function hist .
Note: the options used here are one positional argument and the rest are Keyword arguments . The options are:

• The positional argument x1. Where x1 is the array we would like to histogram
• the number of bins in the histogram
• the range of the histogram bins. In here we are plotting from -5 to 5.
• the drawing option for type of histogram histype.
• histogram color

 ``` n1, b1, p1= plt.hist(x1,bins=10,range=(0.0,10.0),histtype='stepfilled',color='green', weights=weights1,alpha=0.5) n2,b2,p2 = plt.hist(x1,bins=10,range=(0.0,10.0),histtype='stepfilled',color='blue',weights=weights2,alpha=0.5) ```

• Here we assigned return values of hist to be n1,b1,p1. n1 and b1 are often useful. Add some print statements and see if you can figure out what they are.

Other options:

• weights=weights1 here we are multiplying the count number (y-axis) by 1. (Its really doing nothing). However, weights=weights2 is multiplying the count number with (1/length of array) (with this we are plotting P(x)).
• alpha =0.5 is setting the transparency level of the histogram. It ranges between 0-1. (change the value of alpha to see the effect)