Reputation: 33
I want to plot a histogram, how many scrabble words with 2, 3, 4, 5, 6 or 7 chars are found in a dictionary over x trials with a random hand.
The histogram should have the following values on the x and y axis:
I have a list with the results: [0.33, 0.42, 0.33, 1.09, 0.3, 0.0]
, the first value means I've got an average of 0.33 of a 2 char word per hand over 100 trials. The second value is for a 3 chars word an so on.
At the moment I have something like this:
On the x axis there is the avg amount of words, the y axis contains the amount of values (two values are the same, that's why the third line is being printed with value of 2). I have no idea how the code should look like.
Upvotes: 1
Views: 2000
Reputation: 33
Solved with pylab.bar()
:
pylab.figure()
pylab.bar(xaxis, plot_list, align='center', color='green')
pylab.title('Amount of scrabble words, possible to phrase from a random hand (100 trials)')
pylab.xlabel('Length of words')
pylab.ylabel('Average amount of words')
pylab.show()
Here is what the solution looks like:
Upvotes: 2