# Plots histogram for numbers in dist.data
import numpy as np
import matplotlib.pyplot as plt

# Gives the x,y of the histogram for logmasses from the given array of data
def histog( mf, nbins ):
    hist, bin_edges = np.histogram(mf, bins = nbins)
    # Obtains the center point for each bin
    xcenter = (bin_edges[:-1] + bin_edges[1:])/2
    return np.array(xcenter), np.array(hist)

# Loads the file
filename = "dist.data"
data = np.loadtxt(filename)
# Gets x,y points for the histogram with 10 bins
x,y = histog(data,8)
plt.bar(x,y,align='center',width = x[1]-x[0]) # A bar chart
#plt.show()
plt.savefig("graph.png")

1c7bb861463b5bd3071a82eb919bcea045a3190f
<mask token>


def histog(mf, nbins):
    hist, bin_edges = np.histogram(mf, bins=nbins)
    xcenter = (bin_edges[:-1] + bin_edges[1:]) / 2
    return np.array(xcenter), np.array(hist)


<mask token>

<mask token>


def histog(mf, nbins):
    hist, bin_edges = np.histogram(mf, bins=nbins)
    xcenter = (bin_edges[:-1] + bin_edges[1:]) / 2
    return np.array(xcenter), np.array(hist)


<mask token>
plt.bar(x, y, align='center', width=x[1] - x[0])
plt.savefig('graph.png')

<mask token>


def histog(mf, nbins):
    hist, bin_edges = np.histogram(mf, bins=nbins)
    xcenter = (bin_edges[:-1] + bin_edges[1:]) / 2
    return np.array(xcenter), np.array(hist)


filename = 'dist.data'
data = np.loadtxt(filename)
x, y = histog(data, 8)
plt.bar(x, y, align='center', width=x[1] - x[0])
plt.savefig('graph.png')

import numpy as np
import matplotlib.pyplot as plt


def histog(mf, nbins):
    hist, bin_edges = np.histogram(mf, bins=nbins)
    xcenter = (bin_edges[:-1] + bin_edges[1:]) / 2
    return np.array(xcenter), np.array(hist)


filename = 'dist.data'
data = np.loadtxt(filename)
x, y = histog(data, 8)
plt.bar(x, y, align='center', width=x[1] - x[0])
plt.savefig('graph.png')

# Plots histogram for numbers in dist.data
import numpy as np
import matplotlib.pyplot as plt

# Gives the x,y of the histogram for logmasses from the given array of data
def histog( mf, nbins ):
    hist, bin_edges = np.histogram(mf, bins = nbins)
    # Obtains the center point for each bin
    xcenter = (bin_edges[:-1] + bin_edges[1:])/2
    return np.array(xcenter), np.array(hist)

# Loads the file
filename = "dist.data"
data = np.loadtxt(filename)
# Gets x,y points for the histogram with 10 bins
x,y = histog(data,8)
plt.bar(x,y,align='center',width = x[1]-x[0]) # A bar chart
#plt.show()
plt.savefig("graph.png")
