I am trying to plot a histogram with mu and sigma.
Im trying to use the ec_scores values on the y axis, its supposed to show me 0.1 to 1.0 It gives me 1, 2, 3, 4, 5, 6 on the y axis instead. Im not getting any errors but this is throwing off the graph completely. Please assist me and tell me what I am doing wrong and how can i get the graph to be generated properly. Thanks.
This is my code :
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
x = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0])
ec_scores = np.array([1., 1., 1., 0.95923677, 0.94796184, 1., 0.76669558, 1., 0.99913194, 1.])
mu, sigma = (np.mean(ec_scores), np.std(ec_scores))
fig = plt.figure()
ax = fig.add_subplot(111)
n, bins, patches = ax.hist(x, 50, normed=1, facecolor='blue', alpha=0.75)
bincenters = 0.5*(bins[1:]+bins[:-1])
y = mlab.normpdf( bincenters, mu, sigma)
l = ax.plot(bincenters, y, 'r--', linewidth=1)
ax.set_xlabel('Parameters')
ax.set_ylabel('EC scores ')
plt.plot(x, ec_scores)
ax.grid(True)
plt.show()