Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/334.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
Python 如何使用Matplotlib在存储箱之间绘制直方图中的垂直线?_Python_Matplotlib - Fatal编程技术网

Python 如何使用Matplotlib在存储箱之间绘制直方图中的垂直线?

Python 如何使用Matplotlib在存储箱之间绘制直方图中的垂直线?,python,matplotlib,Python,Matplotlib,我目前正在尝试使用Python的matplotlib渲染直方图。我很难在每个箱子之间画垂直线 这是我的当前代码 plt.figure(figsize=[10, 5]) array = np.random.normal(loc=0, scale=1, size=100) plt.hist(array, bins=25, color='#0504AA', alpha=0.5) plt.grid(axis='x', alpha=0.5) plt.grid(axis='y', alpha=0.5)

我目前正在尝试使用Python的matplotlib渲染直方图。我很难在每个箱子之间画垂直线

这是我的当前代码

plt.figure(figsize=[10, 5])

array = np.random.normal(loc=0, scale=1, size=100)
plt.hist(array, bins=25, color='#0504AA', alpha=0.5)

plt.grid(axis='x', alpha=0.5)
plt.grid(axis='y', alpha=0.5)

plt.xlabel('Value',     fontsize=12.5)
plt.ylabel('Frequency', fontsize=12.5)

plt.xticks(fontsize=12.5)
plt.yticks(fontsize=12.5)

plt.title('Histogram Distribution', fontsize=12.5)
plt.show()
这是当前输出

这里是所需的输出

试试这个:

plt.hist(array, bins=25, color='#0504AA', alpha=0.5,edgecolor ="black", linewidth=2)

您是否检查过是否打算添加带间隙或重叠的黑线?