I have data in hashmap and I want to create a histogram for this data using keys as bins and values as data.
My details:
N = {1: 12, 2: 15, 3: 8, 4: 4, 5: 1}
What I want to build:
|
15| X
| X
| X
| X X
| X X
10| X X
| X X
| X X X
| X X X
| X X X
5| X X X
| X X X X
| X X X X
| X X X X
| X X X X X
|_________________________
1 2 3 4 5
I tried to figure out how to do this with pyplot.hist(), but all the overloads that I can find take a list of values, not a hash map. Do I really need to create this list, just so that matplotlib counts all the values again?
source
share