Histogram in Pylab when mu is large
Question: I ran into this problem; it feels like a bug, but it is probably me missing
something, since I am completely new to pylab. When I use the following code:

    
    
    import pylab
    import random as rn
    
    mu = 10
    sigma = 5
    
    z = []
    
    for i in xrange(300):
        z.append(rn.gauss(mu,sigma))   
    
    n, bins, patches = pylab.hist(z, 50, normed=1, histtype='stepfilled')
    
    pylab.show()
    

everything works fine; the values on the y-axis range from 0 to 0.12, which I
would think is a percentage each bin makes up of a whole sample. This makes
perfect sense. However, if change mu = 10 to mu = 20,

    
    
    import pylab
    import random as rn
    
    mu = 20
    sigma = 5
    
    z = []
    
    for i in xrange(300):
        z.append(rn.gauss(mu,sigma))   
    
    n, bins, patches = pylab.hist(z, 50, normed=1, histtype='stepfilled')
    
    pylab.show()
    

my values on y-axis become a lot larger; they now range between 0 and 5, and
this makes no sense. The bars become really squished towards the bottom that
you can barely see them. This problems occurs for any large mu.

One possible solution is to normalize the data such that mu is fairly small,
but I feel like there should be a better solution. Does anyone know what's
going on?

I am using pythonxy on 32bit windows.

Thank You


Answer: I appears to be a bug. I get roughly the same general shape for mu=5 and
mu=20. You can interpret the y-value of a normalized histogram bin as it
probability denisty. The total area of all bins = 1.

