I just wrote some related stuff in the other thread, but will jump in

here. I think I may be being overzealous in my avoidance of arrays. What

we cannot assume is that asarray is creating an array of floats, so we

cannot do scalar array operations, eg 2*x. But we should be able to

assume object arrays, with indexing, and element wise opertations

which are well defined, eg for the canonical date example.

In [3]: import datetime

In [4]: date0 = datetime.date(2004,1,1)

In [5]: days = datetime.timedelta(days=1)

In [6]: d = [date0, date0+days, date0+2*days, date0+3*days]

In [7]: import numpy as n

In [8]: x1 = n.array(d)

In [9]: xerr = n.array([days]*len(x1))

In [10]: x1.dtype

Out[10]: dtype('object')

In [11]: x2.dtype

## ···

On 11/2/07, Eric Firing <efiring@...229...> wrote:

Now I am not so sure that the use of lists in errorbar is a fossil, but

I certainly don't understand it. Would you give a summary of when one

can and cannot use arrays in axes.py, please? The errorbar and bar

methods seem to be the only victims of this restriction, and it looks

like some of the instances are accomplishing nothing--the arguments get

converted to arrays with the next method call anyway. I haven't tried

to trace things carefully, obviously.

------------------------------------------------------------

Traceback (most recent call last):

File "<ipython console>", line 1, in ?

NameError: name 'x2' is not defined

In [12]: xerr.dtype

Out[12]: dtype('object')

In [13]: x1 + xerr

Out[13]: array([2004-01-02, 2004-01-03, 2004-01-04, 2004-01-05], dtype=object)

The reason we are bumping into so may problems with errorbar is not

only because it is complex, but because it is doing more arithmetic

than other plotting code.

Ted, can you clarify what kinds of operations are permitted with your

iterable unit objects if they are initialized into numpy object

arrays?