如何制作带有黑色轮廓的白色直方图?

问题描述 投票:0回答:1
array = np.random.normal(0, 1, 10000)
plt.hist(array, bins = 9, color = "w")
plt.xlabel("Bins")
plt.ylabel("Frequency")

这给了我一个空的直方图,或者更确切地说,它看起来是空的,因为背景和直方图是相同的颜色。如何添加黑色轮廓?

我尝试添加

edgecolor = 'black'

这不会产生预期的结果。我只希望轮廓位于直方图的外部,我只相信周长。

python matplotlib histogram
1个回答
0
投票

我能够通过这样做完成它:

histtype='step'
© www.soinside.com 2019 - 2024. All rights reserved.