A bug in imshow command from matplotlib 0.87.4?

Hello,

I am using numpy 1.0b2 + matplotlib 0.87.4 from Andrew Straw repository
for Ubuntu (http://debs.astraw.com/).

I am playing with some images to present the Theorem of Best
Approximation associated to SVD to my students. I have computed a small
approximated image and I want to plot it using imshow from matplotlib,
but this command presenting a weird behavior with some weird spots in
brigh regions.

If I convert the array to a Numeric array and show it with the view
command from NumTut package (the Numeric tutorial) the picture shows
correctly.

Did I find a bug?

To see what I mean, you can download the following small data file
(saved with "tofile" in a i386 systems, it may not work in different
architectures).

http://www.ime.usp.br/~pjssilva/spot

Now run the following script (you need matplotlib, numpy, Numeric and
NumTut packages):

-- script --

import pylab, numpy, Numeric
from NumTut import view
win = numpy.fromfile('spot').reshape((50,50,3))
pylab.imshow(win)
pylab.show()
view(Numeric.array(win))
raw_input('Press enter to finish')

-- end script --

You should see two big green spots when the image is presented using
matplotlib.

Best,

Paulo

Obs: I am not

I can confirm the strange behavior with the most up-to-date svn versions of
matplotlib and numpy.

···

On Monday 21 August 2006 13:56, Paulo Jose da Silva e Silva wrote:

Hello,

I am using numpy 1.0b2 + matplotlib 0.87.4 from Andrew Straw repository
for Ubuntu (http://debs.astraw.com/).

I am playing with some images to present the Theorem of Best
Approximation associated to SVD to my students. I have computed a small
approximated image and I want to plot it using imshow from matplotlib,
but this command presenting a weird behavior with some weird spots in
brigh regions.

If I convert the array to a Numeric array and show it with the view
command from NumTut package (the Numeric tutorial) the picture shows
correctly.

Did I find a bug?

This is a bit off topic, but I thought that matplotlib 0.87.4 and numpy 1.0b2 didn’t work together. At least they don’t for me; I have these installed on my computer (FC5) but when I set numerix to numpy in matplotlibrc, I get the output

File “/usr/lib/python2.4/site-packages/matplotlib/_transforms.py”, line 1, in ?

import sys, numerix

File “/usr/lib/python2.4/site-packages/matplotlib/numerix/init.py”, line 74, in ?
Matrix = matrix
NameError: name ‘matrix’ is not defined

···

On 8/21/06, Darren Dale <dd55@…143…> wrote:

On Monday 21 August 2006 13:56, Paulo Jose da Silva e Silva wrote:

Hello,

I am using numpy 1.0b2 + matplotlib 0.87.4 from Andrew Straw repository
for Ubuntu (
http://debs.astraw.com/
).
I can confirm the strange behavior with the most up-to-date svn versions of
matplotlib and numpy.

This is a bit off topic, but I thought that matplotlib 0.87.4 and
numpy 1.0b2 didn't work together. At least they don't for me; I have
these installed on my computer (FC5) but when I set numerix to numpy
in matplotlibrc, I get the output

Andrew made the backport for Ubuntu systems. Matplotlib stopped working
with numpy due to some functions that were re-arranged in the code. The
fix is simple if you know what changed in the beta versions of numpy.

Best,

Paulo