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:
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?
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
···
--
Michael Hannon mailto:hannon@…1477…
Dept. of Physics 530.752.4966
University of California 530.752.4717 FAX
Davis, CA 95616-8677