Plot a histogram from a Dictionary

后端 未结 4 1735
-上瘾入骨i
-上瘾入骨i 2020-12-08 09:48

I created a dictionary that counts the occurrences in a list of every key and I would now like to plot the histogram of its content.

This i

4条回答
  •  猫巷女王i
    2020-12-08 10:22

    In case the keys of the myDictionary are not uniformed distributed, its helpful to use the keys as str:

    plt.bar([ str(i) for i in myDictionary.keys()], myDictionary.values(), color='g')
    

提交回复
热议问题