Q:

how to plot histogram of lottery numbers?

I'm using ipython notebook to plot histogram of lottery numbers results. I want to demonstrate how many times each number appeared. I have drawing results in CSV file like matrix. I've tried to load numbers in numpy matrix then convert it to int array and then using matplotlib.pyplot.hist() to plot it - but i get wrong result (looks like wrong bin, only 5 rectangles are show but i can't see the range). What is the easiest way to get this? 

A:

If you don't specify the range and number of bins, matplotlib.pyplot.hist() will guess guess the range and default to 10 bins.  This is usually not what you want.
The following works as expected
import matplotlib.pyplot as plt
from numpy import random
N = random.random_integers( 0, 10, 20 )
plt.hist( N, range=[-.5,10.5], bins=11 )
plt.show()

I did shift the range 0.5 so that the bars would be nicely lined up with the tick marks.  

