[Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions

Wayne Watson sierra_mtnview@sbcglobal....
Thu Nov 26 17:08:04 CST 2009


I guess the answer is easy about why a plot is not produced. The remark 
in the histogram line says this will not work in numpy. Oh, well.

Wayne Watson wrote:
> josef.pktd@gmail.com wrote:
>   
>> On Thu, Nov 26, 2009 at 2:44 PM, Wayne Watson
>> <sierra_mtnview@sbcglobal.net> wrote:
>>   
>>     
>>> I decided to try some example code from Subject.
>>>
>>> import numpy
>>> import pylab
>>> # Build a vector of 10000 normal deviates with variance 0.5^2 and mean 2
>>> mu, sigma = 2, 0.5
>>> v = numpy.random.normal(mu,sigma,10000)
>>> # Plot a normalized histogram with 50 bins
>>> pylab.hist(v, bins=50, normed=1)       # matplotlib version (plot)
>>> pylab.show()
>>> # Compute the histogram with numpy and then plot it
>>> (n, bins) = numpy.histogram(v, bins=50, normed=1)  # NumPy version (no 
...



More information about the NumPy-Discussion mailing list