Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是数据:
111, 3 122, 4 155, 3 192, 5 11, 9 123, 10 120, 23
现在我怎么能用这两组数据绘制直方图matplotlib。请帮忙。
matplotlib
您可以像这样创建条形图:
from matplotlib.pyplot import * x = [111,122,155,192,11,123,120,] y = [3,4,3,5,9,10,23] bar(x,y) show()
给出: 为您 使用hist()数据箱,因此您可以将原始数据传递给它,即。它看起来像这样:
hist()
data = [111, 111, 111, 122, 122, 122, 122, 155, ...]