I am trying to plot y between (0, 1) or between (0 and lees than 1) I tried by many things but the I have bad histogram, if do you think there is a way would you please help me, I used matplotlib.pyplot.ylim(0.0, 1) but doesn't work
the code is
import numpy
import numpy as np
import matplotlib.pyplot
import pylab
data = []
for j in range(40000):
totalX= 0
totalY = 0
for i in range (5):
# calculate order
X = numpy.random.gamma(5.0)
totalX = totalX+ X
# calculate production
Y = min(7.26, X)
totalY = totalY + Y
# calcculate new inventory
#inventory = inventory + production - order
# if inventory < 0:
# inventory = 0
# calculate fill rate for last 5 orders
fr = float(totalY) / float(totalX)
if fr > 1:
fr = 1
# append FR to dataset
data.append(fr)
matplotlib.pyplot.hist(data, normed = True, bins =30, align = 'right')
#matplotlib.pyplot.xticks(([.75, .80, .85, .90, .95, 1]))
matplotlib.pyplot.xlim(.70, 1.009)
#matplotlib.pyplot.minorticks_on()
matplotlib.pyplot.tick_params(axis='both', length = 10)
matplotlib.pyplot.axvline(numpy.mean(data), color = 'r')
matplotlib.pyplot.xlabel('Fill Rate')
matplotlib.pyplot.ylabel('Probability')
pylab.show()