我的平台如下
Centos 6.x(在Win-7主机上运行的VirtualBox VM),Python 2.6.6,Matplotlib 1.3.1,Numpy 1.8.0,Scipy 0.14.0.dev-bb608ba
我正在运行以下histogram.py代码
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
mu, sigma = 0, 1 # mean and standard deviation
f = np.random.normal(mu, sigma, 1000) # generate feature-vector with normal distribution
# plot the histogram - check the distribution
count, bins, ignored = plt.hist(f, 30, normed=True)
plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *
np.exp( - (bins - mu)**2 / (2 * sigma**2) ),
linewidth=2, color='r')
plt.xlabel('Values')
plt.ylabel('Probability')
plt.title('Histogram')
plt.text(60, .025, r'$\mu=0,\ …Run Code Online (Sandbox Code Playgroud)