python plot simple histogram given binned data

前端 未结 6 1422
生来不讨喜
生来不讨喜 2020-12-03 00:58

I have count data (a 100 of them), each correspond to a bin (0 to 99). I need to plot these data as histogram. However, histogram count those data and does not plot correctl

6条回答
  •  孤街浪徒
    2020-12-03 02:02

    If I'm understanding what you want to achieve correctly then the following should give you what you want:

    import matplotlib.pyplot as plt
    plt.bar(range(0,100), x)
    plt.show()
    

    It doesn't use hist(), but it looks like you've already put your data into bins so there's no need.

提交回复
热议问题