Python 柱状图大纲

我在木星(Python 2)中绘制了一个直方图,并希望看到我的条形图的轮廓,但事实并非如此。

enter image description here

我使用以下代码:

import matplotlib.pyplot as plt
from numpy.random import normal
gaussian_numbers = normal(size=1000)
plt.hist(gaussian_numbers)
plt.title("Gaussian Histogram")
plt.xlabel("Value")
plt.ylabel("Frequency")
plt.show()
117124 次浏览

It looks like either your linewidth was set to zero or your edgecolor was set to 'none'. Matplotlib changed the defaults for these in 2.0. Try using:

plt.hist(gaussian_numbers, edgecolor='black', linewidth=1.2)

enter image description here