Michael Hannon wrote:
> Greetings.  I need to make some histograms from within a Python program,
> and I noticed that Matplotlib, which I've never used before, appears to
> have that capability.
> 
> At:
>     http://matplotlib.sourceforge.net/
> 
> I see the following  simple example:
> 
>     >>> from pylab import randn, hist
>     >>> x = randn(10000)
>     >>> hist(x, 100)
> 
> And there is a more-extended example at:
> 
> http://matplotlib.sourceforge.net/_static/plot_directive/mpl_examples/pylab_examples/histogram_demo.py
> 
> Unfortunately, when I run either example I get nothing but complaints
> and errors, as in the appended.
> 
> This is on a system running 64-bit Fedora 9 and Python 2.5.1.
> 
> I'm evidently doing something wrong.  Will somebody please point  me in
> the right direction?


It sounds like your matplotlib version is too old for your numpy 
version.  What version of matplotlib are you using?  Can you install a 
newer one, or, better yet, build from svn?  (The warning from numpy is 
easy to deal with; the TypeError from matplotlib is what indicates that 
the version is incompatible.)

Eric
> 
> Thanks.
> 
>                                       - Mike
> 
> 
> $ python
> Python 2.5.1 (r251:54863, Jun 15 2008, 18:24:56) 
> [GCC 4.3.0 20080428 (Red Hat 4.3.0-8)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from pylab import randn, hist
>>>> x = randn(10000)
>>>> hist(x, 100)
> /usr/lib64/python2.5/site-packages/numpy/lib/function_base.py:343:
> Warning: 
>             The semantics of histogram has been modified in
>             the current release to fix long-standing issues with
>             outliers handling. The main changes concern
>             1. the definition of the bin edges,
>                now including the rightmost edge, and
>             2. the handling of upper outliers, now ignored rather
>                than tallied in the rightmost bin.
>             The previous behaviour is still accessible using
>             `new=False`, but is scheduled to be deprecated in the
>             next release (1.3).
> 
>             *This warning will not printed in the 1.3 release.*
> 
>             Use `new=True` to bypass this warning.
> 
>             Please read the docstring for more information.
>             
>   """, Warning)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib64/python2.5/site-packages/matplotlib/pyplot.py", line
> 1633, in hist
>     ret =  gca().hist(*args, **kwargs)
>   File "/usr/lib64/python2.5/site-packages/matplotlib/axes.py", line
> 5117, in hist
>     n, bins = npy.histogram(x, bins, range=None, normed=normed)
> TypeError: 'NoneType' object is not iterable
> 
> 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to