(no subject)

I've been having trouble gettin histograms to work on arrays. This is not
the particular case that I've had, but illustrates the general error.
Wondering if anyone knew what I was doing wrong? Thanks.

from pylab import *
from numpy import *
x=ones([2,10])
x

array([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]])

hist(x[0])

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 1857,
in hist
    ret = gca().hist(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1676,
in hist
    n,bins = matplotlib.mlab.hist(x, bins, normed)
  File "/usr/lib/python2.4/site-packages/matplotlib/mlab.py", line 617, in
hist
    ymin -= 0.5
TypeError: unsupported operand type(s) for -=: 'str' and 'float'

I've finally figured out why I've been having trouble creating histograms.
As it turns out, if you pass to hist() a datatype that is numpy.ndarray
instead of a Numeric array, you get the following error. Check this out:

import numpy
import Numeric
from pylab import *
y=Numeric.array([1,2])
hist(y) # This works no problem
x=numpy.array([1,2])
hist(x)

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 1857,
in hist
    ret = gca().hist(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1676,
in hist
    n,bins = matplotlib.mlab.hist(x, bins, normed)
  File "/usr/lib/python2.4/site-packages/matplotlib/mlab.py", line 621, in
hist
    dy = (ymax-ymin)/bins
TypeError: unsupported operand type(s) for -: 'str' and 'str'

I'm not exactly sure why this is true, but I've empirically found this out
to be the case. If anyone knows why, I'd sure love to know.

Thanks,
Finny Kuruvilla