Python 使用matplotlib实现高斯分布

Python 使用matplotlib实现高斯分布,python,matplotlib,statistics,Python,Matplotlib,Statistics,所以我试图绘制一个我的数据的柱状图,我似乎有点困惑。我正在python中使用matplotlib。以下是他们网站上的代码: mu = 100 #mean sigma = 15 #std deviation x = mu + sigma * np.random.randn(10000) # the histogram of the data n, bins, patches = plt.hist(x, num_bins, normed=1, facecolor='green', alpha=0

所以我试图绘制一个我的数据的柱状图,我似乎有点困惑。我正在python中使用matplotlib。以下是他们网站上的代码:

 mu = 100 #mean
sigma = 15 #std deviation
x = mu + sigma * np.random.randn(10000)

# the histogram of the data
n, bins, patches = plt.hist(x, num_bins, normed=1, facecolor='green', alpha=0.5)

我不知道我应该用什么样的x轴。我已经计算了标准偏差和平均值,但我不确定是否应该用实际数据替换np.random.randn(10000)。

只需将数据放入
x
变量中即可。您不需要计算均值或方差