Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带固定xlabel的Python正态分布图_Python - Fatal编程技术网

带固定xlabel的Python正态分布图

带固定xlabel的Python正态分布图,python,Python,我是python新手,在过去的两天里我一直在绘制正态分布图。 我有一个列表h=[33186,67180,90,78],但我希望x轴有一个固定的字符串值 对于实例xlabels的每个索引=['A'、'B'、'C'、'D'、'E'、'F'] 我试过了 由于某些原因,我没有得到正确的答案,有什么帮助吗?这是否提供了所需的输出 import numpy as np import scipy.stats as stats import pylab as plt h = sorted([33,186,67

我是python新手,在过去的两天里我一直在绘制正态分布图。 我有一个列表h=[33186,67180,90,78],但我希望x轴有一个固定的字符串值 对于实例xlabels的每个索引=['A'、'B'、'C'、'D'、'E'、'F'] 我试过了


由于某些原因,我没有得到正确的答案,有什么帮助吗?

这是否提供了所需的输出

import numpy as np
import scipy.stats as stats
import pylab as plt

h = sorted([33,186,67,180,90,78])  #sorted

fit = stats.norm.pdf(h, np.mean(h), np.std(h))  #this is a fitting indeed


fig, ax = plt.subplots()

ax.plot(h,fit,'-o')

ax.hist(h,density=True)      #use this to draw histogram of your data
labels = ['A','B','C','D','E','F']

plt.xticks(ticks=h, labels=labels)
plt.show()
import numpy as np
import scipy.stats as stats
import pylab as plt

h = sorted([33,186,67,180,90,78])  #sorted

fit = stats.norm.pdf(h, np.mean(h), np.std(h))  #this is a fitting indeed


fig, ax = plt.subplots()

ax.plot(h,fit,'-o')

ax.hist(h,density=True)      #use this to draw histogram of your data
labels = ['A','B','C','D','E','F']

plt.xticks(ticks=h, labels=labels)
plt.show()