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

Wayne Watson sierra_mtnview at sbcglobal.net
Thu Nov 26 18:08:04 EST 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 at gmail.com wrote:
>   
>> On Thu, Nov 26, 2009 at 2:44 PM, Wayne Watson
>> <sierra_mtnview at 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