我有一个直方图(见下文),我试图找到平均值和标准偏差以及符合我的直方图曲线的代码.我认为SciPy或matplotlib中有一些东西可以提供帮助,但我尝试的每个例子都不起作用.
import matplotlib.pyplot as plt
import numpy as np
with open('gau_b_g_s.csv') as f:
v = np.loadtxt(f, delimiter= ',', dtype="float", skiprows=1, usecols=None)
fig, ax = plt.subplots()
plt.hist(v, bins=500, color='#7F38EC', histtype='step')
plt.title("Gaussian")
plt.axis([-1, 2, 0, 20000])
plt.show()
Run Code Online (Sandbox Code Playgroud)