use of the SciPy Array Interface

Dear developers,

I am a happy user of Matplotlib, which is a wonderful library - thank you!

Would it possible to support the SciPy Array interface in more places to make
Matplotlib less dependent on Numpy/numarray?

In Ubuntu Edgy’s version of Matplotlib it’s possible to use CVXOPT matrices
in some places, but not in others:

from cvxopt.base import matrix
import pylab, numpy
pylab.imshow(matrix([[1.0,2.0],[3.0,4.0]]))
<matplotlib.image.AxesImage instance at 0xb5d560ac>

pylab.matshow(matrix([[1.0,2.0],[3.0,4.0]]))
Traceback (most recent call last):
File “”, line 1, in ?

File “/usr/lib/python2.4/site-packages/matplotlib/pylab.py”, line 1431, in matshow
w,h = figaspect(arr)
File “/usr/lib/python2.4/site-packages/matplotlib/figure.py”, line 932, in figaspect

arr_ratio = float(arg)

TypeError: float() argument must be a string or a number

-Joachim

Joachim Dahl wrote:

Dear developers,

I am a happy user of Matplotlib, which is a wonderful library - thank you!

Would it possible to support the SciPy Array interface in more places to make
Matplotlib less dependent on Numpy/numarray?

I guess you mean numpy where you say scipy and Numeric where you say numpy?

In that case, the answer is yes:

numpy.asarray( you_array_interface_supporting_object_here )

Joachim Dahl wrote:

Dear developers,

I am a happy user of Matplotlib, which is a wonderful library - thank
you!

Would it possible to support the SciPy Array interface in more places

to make
Matplotlib less dependent on Numpy/numarray?
I guess you mean numpy where you say scipy and Numeric where you say numpy?

Probably - I wouldn’t be the first to get the names wrong… :wink:

In that case, the answer is yes:

numpy.asarray( you_array_interface_supporting_object_here )

I know you can convert arrays, but it would nice not to have to. E.g., this works:
imshow(matrix([[1.0,2.0],[3.0,4.0]]),

this doesn’t:
matshow(matrix([[1.0,2.0],[3.0,4.0]])

but this does
matshow(pylab.array(matrix([[1.0,2.0],[3.0,4.0]])

···

On 11/21/06, Andrew Straw <strawman@…36…> wrote: