【发布时间】:2021-03-05 09:41:53
【问题描述】:
这让我发疯,我想知道我是否只是不了解有关直方图、matplotlib 或世界的基本知识。如果我尝试使用 matplotlib 的直方图绘制以下数据,我会得到以下图像,这绝对是不正确的:
import matplotlib.pyplot as plt
v = [1.25, 5.0, 2.0, 1.0, 3.25, 1.75, 0.25, 2.75, 1.25]
fig, ax = subplots()
ax.hist(v, 8, edgecolor='white')
fig.show()
1.25 似乎是正确的,但例如,5 完全错误,1 没有绘制。难道我做错了什么? (注意:matplotlib 直方图的默认对齐方式以值为中心)
【问题讨论】:
标签: python matplotlib